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 LRU queues, see your HCL OneDB™ Performance Guide.

You can specify lightweight I/O by setting the flags parameter to LO_NOBUFFER when you create or open a smart large object. 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 finish with them to free memory allocated to the private buffers.
  • All open operations 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 operation specifies LO_BUFFER, the database server ignores the flag.
  • You can open a smart large object that has been 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 and 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.