18.7. How to Optimize

18.7.1. Tunnel/Mirror (TCP) connections

Read-only connections

On the slave side of the connection, you can determine the data flow direction for the connection. If the data flow is to be one-way, from the master to the slave (i.e. the slave will only read from the master, not write), you will get the fastest performance by configuring the connection "read-only", as follows:

  1. On the DataHub that is making the slave side connection, right click on the DataHub system-tray icon and choose Properties.
  2. In the Properties window, select Tunnel/Mirror .
  3. In the Data Flow Direction section, select Read-only: Receive data from the Master, but do not send.
  4. Click Apply.

Binary mode transmission

Ensure that the slave side of the tunnel/mirror connection is set to use binary mode transmission:

  1. On the DataHub that is making the slave side connection, right click on the DataHub system-tray icon and choose Properties.
  2. In the Properties window, select Tunnel/Mirror .
  3. In the Tunnel/Mirror Slave section, highlight the host name of the tunnelling master, and click the Edit button to open the Tunnel/Mirror Master Configuration window.
  4. Check the Transmit point changes in binary box.
  5. Click Apply.

For more information, please refer to Section 18.1, “Binary Mode Tunnel/Mirror (TCP) Connections”.

Slow network

To optimize performance for a slow network, you can set the heartbeat timeout to 0 on the slave side, as follows:

  1. On the DataHub that is making the slave side connection, right click on the DataHub system-tray icon and choose Properties.
  2. In the Properties window, select Tunnel/Mirror .
  3. In the Connection Properties section, enter 0 in the Timeout entry field.
  4. Click Apply.

For more information, please refer to Section 18.2, “Tunnel/Mirror (TCP) Connections for Slow Networks”.

Old value queueing and un-buffered delivery

Configure the master side of the tunnel/mirror connection:

  1. On the DataHub that is the master for the tunnel/mirror connection, right click on the DataHub system-tray icon and choose Properties.
  2. In the Properties window, select Tunnel/Mirror .
  3. In the Tunnel/Mirror Master section, you can choose between one of three states:

      No queuing with buffered delivery.  This is the fastest state. To do this, un-check the option Try to send data even if it is known to be superseded in the Tunnel/Mirror configuration tab:

      Queuing with buffered delivery.  This is a reasonable compromise that will keep up to three old values for each data point if there is a short burst of heavy data traffic. If there are more than three values for a point outstanding, the oldest will be discarded. To do this, check the option Try to send data even if it is known to be superseded, but do not select any of the data types below it:

      Queuing with un-buffered delivery. This is the slowest mode, but also the one least likely to discard old values during short periods of heavy data traffic. In this mode there is a queue of up to 3 old values for each data point. In addition, you may choose to force the data transmission when a point with any of the specified types changes. The goal here is to possibly allow buffering (and hence, possible discarding of old values) for some types, while attempting to preserve all changes for other types. For example, here we have chosen to force an outbound transmission if any boolean or string value changes, but to buffer any changes in floating point and integer types:

  4. Click Apply.

For more information, please refer to Section 18.3, “Old Value Queuing” and Section 18.4, “Un-Buffered Delivery”.

18.7.2. DataHub C++ API

Binary mode connections

  • In your program, call the method
    CDataHubConnector::sendBinaryPointMessage(bool enable)
    to enable or disable binary messages.

For more information, please refer to Section 18.1, “Binary Mode Tunnel/Mirror (TCP) Connections”.

18.7.3. Gamma scripts

The Gamma engine services all DataHub scripts through a single queue, for the sake of efficiency. This means that any changes you make to the default behaviour will apply to all running scripts. By default, the Gamma engine runs with a 3-deep queue and buffered transmission. This is equivalent to the queuing with buffered delivery option (above) for TCP/IP connections. As of OPC DataHub version 6.4.2, you can modify the behaviour of the queuing and the buffering via Gamma function calls:

    set_point_queue_depth lets you specify the depth of the per-point queue. It is wise to keep this value small. Please see set_point_queue_depth in the DataHub Scripting manual for details about this function.

    get_point_queue_depth determines the current point queue depth for Gamma. Please see get_point_queue_depth in the DataHub Scripting manual for details about this function.

    set_point_flush_flags sets which data types will cause the point buffer to immediately be transmitted to the Gamma engine. Please see set_point_flush_flags in the DataHub Scripting manual for details about this function.