Buffering refers to an interface node’s ability to temporarily store the data that interfaces collect and to forward these data to the appropriate PI Servers. OSIsoft strongly recommends that you enable buffering on your interface nodes. Otherwise, if the interface node stops communicating with the PI Server, you lose the data that your interfaces collect.
Linux Interface Nodes
Currently, the PI Buffer Subsystem is not available for Linux platforms. The PI API Buffer Server (bufserv) is the only option available for Linux interface nodes.
Because the ICU is also not available for Linux then bufserv must be configured by editing the piclient.ini file on the interface node. For more details on the configuration of bufserv under Linux, see section Configuring PI API Buffer Server (bufserv) Manually.
How Buffering Works
A complete technical description of bufserv is beyond the scope of this document. However, the following paragraphs provide some insights on how buffering works.
When an Interface Node has Buffering enabled, the buffering application (bufserv) connects to the PI Server. It also creates shared memory storage.
When an interface program makes a PI API function call that writes data to the PI Server (for example, pisn_sendexceptionqx()), the PI API checks whether buffering is enabled. If it is, these data writing functions do not send the interface data to the PI Server. Instead, they write the data to the shared memory storage that the buffering application created. If the shared memory is full, the PI API will write the data to disk.
The buffering application (bufserv) in turn
bufserv checks the status of the connection to the PI Server
if a connection to the PI Server exists
bufserv reads the data in the shared memory and sends the data to the PI Server
if the shared memory is empty then data is available on disk, the data is loaded from the disk into the shared memory
if there is no connection to the PI Server, bufserv is wait for recheck the connection.
As a previous paragraph indicates, Bufserv creates shared memory storage at startup. These memory buffers must be large enough to accommodate the data that an interface collects during a single scan. Otherwise, the interface may fail to write all its collected data to the memory buffers and be forced to write to disk on every scan. This is inefficient and should be avoided. The buffering configuration section of this chapter provides guidelines for sizing these memory buffers.
When buffering is enabled, it affects all interfaces connecting to the buffered PI Server. That is, you cannot have a scenario whereby the buffering application buffers data for one interface sending data to a PI Server on an Interface Node but not for another interface sending data to the PI Server on the same Interface Node.
Buffering and PI Server Security
After you enable buffering, it is the buffering application – and not the interface program – that writes data to the PI Server. If the PI Server’s trust table contains a trust entry that allows all applications on an interface node to write data, then the buffering application is able write data to the PI Server.
However, if the PI Server contains an interface-specific PI Trust entry that allows a particular interface program to write data, you must have a PI Trust entry specific to buffering. The following are the appropriate entries for the Application Name field of a PI Trust entry:
Buffering Application
|
Application Name field for PI Trust
|
PI Buffer Subsystem
|
PIBufss.exe
|
PI API Buffer Server
|
APIBE (if the PI API is using 4 character process names)
APIBUF (if the PI API is using 8 character process names)
|
To use a process name greater than 4 characters in length for a trust application name, use the LONGAPPNAME=1 in the PIClient.ini file.
Configuring PI API Buffer Server (bufserv) Manually
The following settings are valid for both Windows and Linux platforms. However, when running on Windows platforms, OSIsoft highly recommends using the ICU to edit the settings. Because the ICU is not available for Linux platforms then the settings can only be changed manually.
PI API Buffering is enabled through the use of a configuration file piclient.ini. Unless this file is modified to explicitly enable buffering, the PI API will not buffer data. Instead, it sends data directly to the PI Server.
Note: When buffering is configured to be on, the bufserv process must be started before other programs using the PI API, so that these programs can access the shared buffering resources. Any program that makes a connection to a PI Server has this requirement even if it does not write data to the PI Server.
Configuration of buffering is achieved through entries in the piclient.ini file. On Linux systems, the file is found in the dat subdirectory of the PIHOME directory (e.g., /opt/piapi/dat). This file follows the conventions of Microsoft Windows initialization files with sections, keywords within sections, and values for keywords. All buffering settings are entered in a section called [APIBUFFER]. To modify settings, simply edit the piclient.ini file in a text editor (Notepad on Windows, vi on Linux) to the desired values.
Performance Settings
The following settings are available for PI API Buffering configuration:
-
Keywords
|
Values
|
Default
|
Description
|
BUFFERING
|
0,1
|
0
|
Turn off/on buffering. OFF = 0, ON = 1,
|
PAUSERATE
|
0 - 2,000,000
|
2
|
When buffers are empty the buffering process will wait for this long before attempting to send more data to the PI Server (seconds)
|
RETRYRATE
|
0 - 2,000,000
|
120
|
When the buffering process discovers the home node is unavailable it will wait this long before attempting to reconnect (seconds)
|
MAXFILESIZE
|
1 - 2,000,000
|
128,000 for UNIX/Linux
2,000,000 for Windows
|
Maximum buffer file size before buffering fails and discards events. (Kbytes)
|
MAXFILECOUNT
|
1 - 2,000,000
|
100
|
Maximum number buffer files to be created. (UNIX/Linux platforms only)
|
PUTSNAPARRAYSIZE
|
1 - 2,000,000
|
800
|
Maximum number of events to be sent as a single block.
|
MAXTRANSFEROBJS
|
1 - 2,000,000
|
1600
|
Maximum number of events to send between each SENDRATE pause.
|
BUF1SIZE
|
64 - 2,000,000
|
32768
|
Primary memory buffer size. (bytes). To improve the bufserv throughput, it is recommended that this value be increased to 1048576 (1 MB).
|
BUF2SIZE
|
64 - 2,000,000
|
32768
|
Secondary memory buffer size. (bytes) To improve the bufserv throughput, it is recommended that this value be increased to 1048576 (1 MB).
|
SENDRATE
|
0 - 2,000,000
|
100
|
The time to wait between sending up to MAXTRANSFEROBJS to the server (milliseconds). To improve the bufserv throughput, it is recommended that this value be decreased to 20.
|
Use the MAXFILESIZE and MAXFILECOUNT parameters to control the total amount of disk space that the buffered data files can consume. By default, bufserv can create 100 128MB files, for a total of 12.8 GB of data.
In addition to the [APIBUFFER] section, the [PISERVER] section may be used to define the default PI Server and an optional time offset change that may occur between the client and server.
-
Keywords
|
Values
|
Default
|
Description
|
PIHOMENODE
|
string
|
none
|
On Unix machines, this keyword specifies the default PI Server.
On Windows the default PI Server is in pilogin.ini
|
DSTMISMATCH
|
0 - 2,000,000
|
0
|
The time that the server and client local time offset is allowed to jump. Typically, 3600 if the nodes are in time zones whose DST rules differ (seconds)
|
LONGPROCNAME
|
0 - 1
|
0
|
If set the PIAPI will use up to 8 characters for the PI server procname identifier. By default, the PIAPI will 4 characters followed by an E.
This setting can affect the PI Server trust configuration.
| BufServ and n-way buffering
To enable buffering for a PI server, each PI server must be listed in the [BUFFEREDSERVERLIST] section of the piclient.ini file. Each PI server in the list has a unique keyword, BUFSERVx where x is a number counting from 1 upwards.
The following is an example of two independent PI servers that are buffered from the interface node, but are NOT members of a collective.
[BUFFEREDSERVERLIST]
BUFSERV1=PI_PLANT
BUFSERV2=PI_CORPHQ
PI Servers in a Collective
When the PI servers are members of a collective and so the events sent to one must also be sent to the other then as well be being listed in the [BUFFEREDSERVERLIST], the PI Servers must also be [REPLICATEDSERVERLIST] section. Each PI server in the list has a unique keyword, REPSERVx where x is a number counting from 1 upwards.
For example,
[BUFFEREDSERVERLIST]
BUFSERV1=PISERVER_PRI
BUFSERV2=PISERVER_SEC
[REPLICATEDSERVERLIST]
REPSERV1=PISERVER_PRI
REPSERV2=PISERVER_SEC
Share with your friends: |