24.1 Memory Management
The graph server (PGX) requires both on-heap and off-heap memory to store graph data.
The allocation of memory for the graph data is as shown:
- Graph indexes and graph topology are stored off-heap.
- All primitive properties (integer, long, double, float, boolean, date, local_date, timestamp, time, point2d) are stored off-heap.
- String properties are stored on-heap.
Default Configuration of Memory Limits
You can configure both on-heap and off-heap memory limits. In case of the on-heap, if you don't explicitly set a maximum then it will default to the maximum on-heap size determined by Java Hotspot, which is based on various factors, including the total amount of physical memory available.
You can set the
max_on_heap_memory_usage_ratio
configuration field to decide on the ratio
of the total JAVA heap memory that the graph server (PGX) is allowed to use (for example a
value of 0.8
would mean that the graph server(PGX) is allowed to use 80% of
JAVA heap memory). The default value of this parameter is 1.0
which lets
the JVM handle any out of memory errors. It is recommended to set this parameter to
0.9
to avoid the graph server (PGX) from using the full on heap memory as
this may cause the server to slowdown or crash.
In case of the off-heap, if you don't explicitly set a maximum then it will default to the total physical available memory on the machine.
Parent topic: Memory Consumption by the Graph Server (PGX)
24.1.1 Configuring On-Heap Limits
systemd
configuration file for the PGX service. However,
there is a risk of losing the updates to the configuration file, the next time you
upgrade the graph server (PGX). Therefore, it is recommended that you provide the
on-heap memory configuration in a drop-in file. All directives in the drop-in file are
dynamically merged with the directives in the main configuration file
(/etc/systemd/system/pgx.service
) during the graph server (PGX)
startup.
Note:
The graph server (PGX) periodically checks the on-heap memory size. If the memory usage grows above the threshold defined in themax_on_heap_memory_usage_ratio
field
(default value is 0.9
) in the
/etc/oracle/graph/pgx.conf
file, then the graph server will
throw an exception and cancel the current running task (which is unable to allocate
memory). This eliminates the possibility of unexpected server crashes when the heap
memory is full. It is recommended that you configure the
max_on_heap_memory_usage_ratio
option to be less than one, so
that the used on-heap memory value remains lesser than the JVM -Xmx
value to ensure a safe buffer for heap memory allocation.
You can perform the following steps to create a drop-in file and configure the on-heap memory size:
Parent topic: Memory Management
24.1.2 Configuring Off-Heap Limits
You can specify the off-heap limit by setting the max_off_heap_size
field in the graph server (PGX) configuration. See Configuration Parameters for the Graph Server (PGX) Engine for more information on the max_off_heap_size
parameter. Note that the off-heap limit is not guaranteed to never be exceeded because
of rounding and synchronization trade-offs.
Parent topic: Memory Management