Optimistic Buffering

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Optimizing Performance >

Optimistic Buffering

 

By default, TApolloTable will optimistically buffer all tables opened in EXCLUSIVE and, when TApolloEnv.OptimisticBuffering is True, all tables opened SHARED on a LOCAL hard drive. When tables are opened SHARED on a local hard drive, the access speeds approach EXCLUSIVE times.

 

The basic philosophy behind optimistic buffering is that all file reads and writes are cached as long as possible. This allows TApolloTable to visit a memory buffer for information instead of reading from or writing to disk. Besides speed benefits there are other subtle benefits. A file opened in shared mode on a local disk will only be opened once per task, no matter how many workareas are attached to the table. This saves on file handles and other system resources.

 

The current implementation of Optimistic Buffering uses a maximum of 30k per file for buffering. In future releases of Apollo, this will probably be a selectable amount, but currently this is a fixed buffer size.

Caveats for Optimistic Buffering:

There are a few definable caveats for the use of Optimistic Buffering. These are the same caveats that inherent in the Borland Database Engine (BDE).

 

1.  Apollo can not detect if a LOCAL hard drive is a shared volume under a peer to peer network, such as Windows 95/98 or WindowsNT. If your application is opening a local table that is also to be opened by users logging into your local machine, turn Optimistic Buffering off using TApolloEnv's OptimisticBuffer property. This should be called before opening any tables.

2.  If data tables opened on a LOCAL hard drive are opened by TApolloTable and another DBMS (i.e. Clipper or FoxPro), Optimistic Buffering should be turned off. When TApolloTable opens a table with Optimistic Buffering on, file writes are cached and the physical files on the hard drive are not updated until the memory buffers are flushed. The net result is that a file opened under Optimistic Buffering is only guaranteed to be current for an Apollo-based application.

 

See Also

TApolloEnv.OptimisticBuffer