How to use sessions efficiently

This topic describes how to use file server session effectively.

For most purposes, it is not necessary for the user of the file server to be aware that it is implemented in a client-server architecture. However, for some purposes, you can make your programs much more efficient if you are aware of the implications of client-server interaction.

Essentially, you gain efficiency by using as few as possible client-server calls. The main technique for achieving this is to transfer more data with each file server function call. Things to watch out for include:

  • Data transfer: use a large buffer, and then read bytes from the buffer. The main data-transfer clients of the file server all operate through the stream store and the relational database. Buffering has been highly optimized for these two components. Therefore, application programs using these components automatically gain the maximum efficiency in data transfer, without needing any explicit optimization.

  • Reading directories

    There are functions to read a single directory entry at a time, but it is often more useful to read multiple directory entries from the server and then to scan through them client-side.

  • Large-scale copying, moving and other file management operations

    A single class, CFileMan, provides high-level function for this, involving only a small number of client-server calls.

The TParseBase hierarchy of classes, for analyzing file names, operates without client-server interaction.