Performance
Our drivers are optimized for performance using the techniques below.
Cursor Type
The forward-only cursor is faster than any other cursor type. The Connectivity Kits use the forward-only cursor for every find done outside of a transaction. It always uses forward-only cursors for tables that are set never to lock (DF_FILE_MODE set in such a way that the DF_FILE_MODE_NO_LOCKS bit is set). For any find operation done inside a transaction, the cursor type depends on usage.
Block Cursors
The Connectivity Kits fetch multiple records when retrieving data from a cursor. The number of records that are fetched can be configured per table by using the intermediate file keyword Block_Size (minimal value = 2). Getting multiple records is not done for cursors created to handle a find equal operation. This reduces the number of times the driver needs to communicate with the database server (server round trips).
Block cursors speed up find operations and create a form of caching. The driver retrieves multiple records at a time, and on every subsequent find, it gets the record from memory rather than from the backend. A find cache timeout can be configured in milliseconds (default value is 10 milliseconds). When the time between two find operations exceeds the timeout, the driver fetches the data from the database even if not all records in the cache have been processed. The timeout can be configured using the Find_Cache_Timeout driver configuration file keyword.
The block size of a table can also be set by using the DF_FILE_BLOCK_SIZE table-level attribute. This attribute can be set both inside and outside of a Structure_Start ... Structure_End operation.
Two table-level attributes can be used to measure the effectiveness of the current find cache timeout setting. The attributes DF_FILE_FINDCACHE_HITS and DF_FILE_FINDCACHE_TIMEOUTS return the number of cache hits (usage of cache) and timeouts (discarding the cache and getting data from the server) respectively. The find logic increments the appropriate attribute when needed. The attributes are kept in signed integer variables. Whenever incrementing the integer value of one of the attributes causes the value to become negative, both variables are set to 0 (zero). It is possible to set the attributes to 0 (the only allowed value). Setting one of the attributes will automatically cause the other attribute to be set to 0.
Statement Handles
The CLI-based Connectivity Kits allocate two statement handles per table. One statement handle is used for all find equal operations on any index; the other one is used for all other find operations.
JIT Binding
To minimize network traffic, the driver does not retrieve all columns of a table. If data in a column is large (default > 10 megabytes), its value will not be placed in the buffer during a normal find operation; the value will be placed in the buffer the first time the column value is accessed by the program.
JIT binding can be configured on two levels. At the driver level, you can set the threshold that makes a column eligible for JIT binding (default 10 Mb) using the JIT_Treshold keyword. At the table level, you can switch the use of JIT binding on or off (default on) using the JIT_Binding intermediate file keyword.
If JIT binding is switched off for a table, every column’s value will be placed in the buffer during find operations.
JIT Binding can also be switched on and off by using the DF_FILE_JIT_BINDING table-level attribute. This attribute can only be set inside a Structure_Start ... Structure_End operation.