Lightweight I/O

When the database server accesses smart large objects, it uses buffers from the buffer pool for buffered access. Unbuffered access is called lightweight I/O. Lightweight I/O uses private buffers instead of the buffer pool to hold smart large objects. These private buffers are allocated out of the database server session pool.

Lightweight I/O allows you to bypass the overhead of the least-recently-used (LRU) queues that the database server uses to manage the buffer pool. For more information about LRUs, see your HCL OneDB™ Performance Guide.

You can specify lightweight I/O by setting the flags parameter to LO_NOBUFFER when you create a smart large object with the ifx_lo_create() function or when you open a particular smart large object with the ifx_lo_open() function. To specify buffered access, which is the default, use the LO_BUFFER flag.
Important: Keep in mind the following issues when you use lightweight I/O:
  • Close smart large objects with ifx_lo_close() when you are finished with them to free memory allocated to the private buffers.
  • All opens that use lightweight I/O for a particular smart large object share the same private buffers. Consequently, one operation can cause the pages in the buffer to be flushed while other operations expect the object to be present in the buffer.
The database server imposes the following restrictions on switching from lightweight I/O to buffered I/O:
  • You can use the ifx_lo_alter() function to switch a smart large object from lightweight I/O (LO_NOBUFFER) to buffered I/O (LO_BUFFER) if the smart large object is not open. However, ifx_lo_alter() generates an error if you try to change a smart large object that uses buffered I/O to one that uses lightweight I/O.
  • Unless you first use ifx_lo_alter() to change the access mode to buffered access (LO_BUFFER), you can only open a smart large object that was created with lightweight I/O with the LO_NOBUFFER access-mode flag. If an open specifies LO_BUFFER, the database server ignores the flag.
  • You can open a smart large object that was created with buffered access (LO_BUFFER) with the LO_NOBUFFER flag only if you open the object in read-only mode. If you attempt to write to the object, the database server returns an error. To write to the smart large object, you must close it then reopen it with the LO_BUFFER flag and an access flag that allows write operations.

You can use the database server utility onspaces to specify lightweight I/O for all smart large objects in an sbspace. For more information about the onspaces utility, see your HCL OneDB Administrator's Guide.