Servlet buffer pools

Internally, EAServer uses 4K and 8K temporary buffers when assembling servlet responses. These buffers are pooled and reused to avoid the overhead of repeated buffer allocation and garbage collection. To tune the number of buffers pooled, you can set the server properties below, using the Advanced tab in the Servlet properties window:

The default for both is 128. You can override the default by setting the value to a positive integer. A value of 0 means buffers are never pooled

The required buffers are allocated on an as-needed basis, rather than being preallocated as server start-up. Once allocated, buffers are pooled and reused until the specified size is reached. If a peak in client activity requires more buffers than the pool size, additional buffers are allocated, then released for garbage collection after use.

The default configuration suffices for most applications. If the buffer pool size is too small, performance.may decline due to allocation of new buffers. Allocation is costly because the Java VM initializes the allocated byte arrays to 0, which is not required by EAServer. Garbage collection is also costly. On the other hand, if the buffer size is too large, buffers allocated during periods of peak activity may be rarely used while consuming memory that would otherwise be available for other tasks.

For request processing, EAServer uses 8K buffers by default, and uses 4K buffers only when a servlet calls ServletResponse.setBufferSize() to request a buffer size other than 8K. If your application never or seldom changes the buffer size, you can set com.sybase.jaguar.server.servlet.max4kbuffers to 0 so that 4K buffers are not pooled.

To determine whether the settings are correct, examine the servlet request patterns to see if the number of concurrent requests often exceeds the buffer pool sizes. If so, consider increasing the value.