- -Xmx (maximum heap)
- -
- -Xms (start heap)
- -
- Metaspace limit
- -
- Database buffers
- -
- Left for OS and cache
- -
- Collector
- -
How the numbers are chosen
The heap is only part of a JVM process. Metaspace, thread stacks, the code cache and native buffers add 300 to 600 MB on top, and the operating system needs memory for its file cache. So we give the heap a fixed share of RAM: 45% when a database runs on the same server, 60% when it does not. The database gets 15% for its buffers (innodb_buffer_pool_size for MySQL and MariaDB, shared_buffers for PostgreSQL). The rest stays free for everything else.
If you know the live data after a full garbage collection, enter it. A healthy heap is at least 2.5 times that. If the result is below it, the calculator tells you which server size you need.
Reference table
| Server RAM | Heap with database | Heap without database | Typical use |
|---|---|---|---|
| 2 GB | about 900 MB | about 1.2 GB | One small API or WAR |
| 4 GB | about 1.8 GB | about 2.4 GB | Light production |
| 8 GB | about 3.6 GB | about 4.8 GB | Production with database, WildFly or Payara |
| 16 GB | about 7.2 GB | about 9.6 GB | Several applications |
| 32 GB | about 14.4 GB | about 19.2 GB | Busy applications |
| 64 GB | about 28.8 GB | about 38.4 GB | Very large workloads |
Notes
- WildFly and Payara use 500 to 700 MB before your application loads. Use 4 GB as a minimum for them.
- These are starting points. Measure under real load, then adjust. See JVM heap settings.
- If the service dies without a Java error, the server ran out of memory. See fix OutOfMemoryError.
- The calculation runs in your browser. Nothing is sent to us.