Configuring the off-heap memory

To prepare your system for use, you must first configure the off-heap memory.

The memory module is responsible for allocating and managing chunks of off-heap memory. For more information, see the Memory section of the Modules topic.

Checking off-heap memory allocation

Siren Federate provides a cluster-level API that allows you to retrieve statistics about the cluster and the off-heap memory allocation.

The allocated direct memory represents the off-heap memory chunks pre-allocated to accommodate the root allocator.

The chunk of off-heap memory that was allocated is kept and reused, because off-heap memory allocation is expensive.

The root allocator can then allocate off-heap memory buffers of various size in a very efficient way.

Setting off-heap memory

You configure the amount of off-heap memory available for the root allocator by updating the siren.memory.root.limit variable in the config/elasticsearch.yml file.

To set a limit for the root allocator, you must:

  1. Open the config/elasticsearch.yml file and set the siren.memory.root.limit parameter to a value that is less than the value you set in step 2, for example, 2147483647.

    It is forbidden to use a limit that is greater than or equal to the maximum direct memory limit.

  2. Start the Elasticsearch instance. The following info logs are displayed:

    [2019-12-10T17:29:11,207][INFO ][i.s.f.c.i.m.BufferAllocatorService] [node_s0] Buffer allocator service starting with Unsafe access: true
    [2019-12-10T17:29:11,207][INFO ][i.s.f.c.i.m.BufferAllocatorService] [node_s0] Buffer allocator service starting with directMemoryLimit=2147483648 (1)
    [2019-12-10T17:29:11,233][INFO ][i.s.f.c.i.m.BufferAllocatorService] [node_s0] Buffer allocator service starting with defaultNumDirectArenas=5
    [2019-12-10T17:29:11,236][INFO ][i.s.f.c.i.m.BufferAllocatorService] [node_s0] Instantiating root allocator with limit=2147483647 (2)

    These info logs provide an overview of how Siren Federate is configured. Here, we can see that:

    1 The maximum direct memory limit is correctly set to the platform dependent memory limit.
    2 The root allocator limit is correctly set to 2147483647.

It is critical to ensure that there is enough available memory on the machine to accommodate the maximum direct memory limit for Siren Federate, the JVM maximum heap memory limit, and the operating system.

If the sum of maximum direct memory limit for Siren Federate and the JVM maximum heap memory limit does not leave enough memory for the operating system, the OS might stop the Elasticsearch instance (OOM killer process on Linux systems).

Configuring a 64GB machine

The following are the recommended settings for a cluster that needs to execute joins on a large amount of data:

  • 24 GB heap for Elasticsearch

  • 16 GB off-heap for Siren Federate

config/jvm.options
-Xmx24g
config/elasticsearch.yml:
siren.memory.root.limit: 17179869184

If the off-heap memory assigned to Siren Federate is not enough, you can increase it while trying to maintain at least a 1:30 ratio between free system memory and the size of local Elasticsearch data.

If the ratio between free system memory and the local Elasticsearch data is lower than 1:30 or you experience performance issues in search requests not using joins, it is recommended to start increasing the number of data nodes in the cluster to maximize the use of the filesystem cache.

Configuring a 128GB machine

  • 30 GB heap for Elasticsearch

  • 16 GB off-heap for Federate

config/jvm.options
-Xmx30g
config/elasticsearch.yml:
siren.memory.root.limit: 17179869184

Alternatively, if the off-heap memory for Siren Federate is not fully used, it is better to give more heap memory to the operating system and the OS cache.