> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How JVM tuning can improve Atoti performance

> How JVM tuning improves Atoti Java SDK performance by sizing heap memory for query execution and off-heap memory for datastore structures, and when to tune to avoid OutOfMemoryError and GC pauses.

JVM (Java Virtual Machine) tuning can help Atoti’s performance because the JVM manages memory allocation and garbage collection.

* **Avoids memory-related errors:** Insufficient heap or off-heap memory can lead to OutOfMemoryError or failed data loads.
* **Reduces application pauses:** Stop-the-world garbage collections can freeze the application during heavy workloads.
* **Improves stability:** Balanced memory allocation prevents crashes caused by OS memory limits.

## Which JVM memory areas does Atoti use?

### Heap memory

* Used for query execution.
* Subject to garbage collection.
* Grows and shrinks dynamically.

### Off-heap memory

* Stores most of the data structures of the cubes and datastores.
* Not managed by garbage collection.
* Must be explicitly sized.

<img src="https://mintcdn.com/activeviam/lTzImDUNm0cHRUws/images/atoti-concepts/performance-jvm-memory.png?fit=max&auto=format&n=lTzImDUNm0cHRUws&q=85&s=2b6de1027546a0b88219d9470d92ec13" alt="performance-jvm-memory.png" width="1784" height="1381" data-path="images/atoti-concepts/performance-jvm-memory.png" />

## When to tune JVM settings

JVM tuning is most effective when:

* Large datasets require significant off-heap memory.
* Frequent queries cause heavy heap usage.
* Stop-the-world GCs impact performance during data loading or real-time updates.

### Avoid excessive memory allocation

* The sum of heap and off-heap memory must not exceed OS capacity.
* Leave room for other processes to prevent JVM crashes.

## Related reading

* [How to tune JVM settings with Atoti Java SDK](/engine/java-sdk/latest/configuration/memory_management)
* [How to tune JVM settings with Atoti Python SDK](https://docs.activeviam.com/products/atoti/python-sdk/latest/getting_started/deployment/deployment_setup.html#java-options)
