File Read Optimization

The overheads associated with reading a file from the presentation client is reduced by lowering the number of messages sent between the application server and the presentation client if the file is "static"; that is, the file is opened for input only (mode = Mode_Input) with the File class shareMode property set to Share_Read or Share_Exclusive.

Under those conditions, the file is read by the application server in chunks from the presentation client and the file buffer management is then performed by the application server so that performance is not affected by whether the File class readLine, readString, or readBinary method is used to access the file.

As files are opened as Share_ReadWrite by default, to achieve this performance boost your logic must set the required shareMode property value for the file. This applies to the processing of schema (.scm) and form and data definition (.ddb or .ddx) file loads, resulting in a dramatic reduction of the number of messages required to process the files when running in thin client mode. A 200-to-1 reduction has been seen on a large form and data definition file, which is due to the way the .ddb or .ddx file is read, with continual peek requests requiring reads, seek repositioning, and re‑reading.

This optimization is not used when reading UTF8 files, non-native files (that is, Unicode files on an ANSI system or ANSI files on a Unicode system) or if the value of the File class maxRecordSize property is greater than 4K bytes.

The maximum size of data that can be read or written by each read or write type statement when the value of the TcpIpConnection class usePresentationClient property is true is 2G bytes. If the data exceeds this limit or the length is less than zero (0), exception 5047 (Invalid record size) is raised.