Memory Reserve for Persistence Services

Memory reserve is pre-allocated memory with which a persistence service could continue limited operations after exhausting available memory.

Caveat

For best results, avoid exhausting available memory. Techniques include pre-production resource allocation testing and appropriate configuration of the persistence store’s byte limit parameter.

Memory reserve does not guarantee continued operation, merely a best effort attempt. For example, other processes could interfere with memory reserve operation.

Background Information

Stored messages occupy process memory within a persistence service. As a persistence service accumulates message data from publishers, it allocates memory. As clients consume stored messages, the persistence service reclaims their memory.

If the operating system denies a request to allocate memory, the persistence service must discontinue normal operation. However, the persistence service can continue partial service using its memory reserve.

Behavior

The following sequence describes the behavior of memory reserve:
  1. Message data growth exhausts available memory on the persistence service host computer.

    Such growth could indicate that subscribing clients are operating slowly, or not operating at all. Alternatively, the issue could result from high demand for memory by another process on the persistence service host computer.

  2. The persistence service rejects all new inbound data messages from publishing clients.
  3. Meanwhile, the persistence service attempts to use memory from the reserve for limited operation, for example, to continue replication, and to service data requests and acknowledgements from subscribing clients.
  4. The demand for memory subsides.
    Any of these factors can help reduce demand:
    • Subscribing clients consume and acknowledge stored messages.
    • Administrators selectively purge durables.
    • Other processes on the persistence service host computer deallocate memory.
  5. When the persistence service can reallocate its full memory reserve, it resumes accepting and storing new messages from publishing clients.

Size

Administrators can specify the memory reserve using the configuration file parameter mem-reserve.

As a rule of thumb, reserve an additional 10% of the maximum expected volume of stored message data. For best results, test persistence service behavior in a pre-production environment, and adjust the size of the memory reserve accordingly.