JVM container memory and database pool sizing
Two questions that cause many production incidents: how much of a container's memory should the Java heap get, and how many database connections should each instance open. Enter your numbers to get a plan and the flags. Runs in your browser; we only count anonymous visits.
1. JVM memory in a container
2. Database connection pool
How to use this tool
- Enter the memory limit and CPUs of one container. Choose a MaxRAMPercentage and your best estimates for threads and native memory.
- Check that the total plan fits inside the limit with some headroom. A plan that exceeds it will be killed by the container runtime.
- For the pool, enter the database server size and how many instances share it; the result is capped so that all instances together stay inside the database limit.
Example
With the pre-filled numbers, 4 instances at the HikariCP starting formula (cores × 2 + spindles = 9) open 36 connections, well inside 80 usable connections. Raise the instances to 20 and the page caps each pool so the total stays under the database limit.
Limits
This is arithmetic with typical defaults (1 MiB thread stack, 240 MiB reserved code cache, direct memory capped by the heap). Real usage depends on the application: measure with Native Memory Tracking and your monitoring. The pool formula is a starting point from the HikariCP project; load tests decide the final size. Oracle uses sessions and processes limits instead of max_connections.
Privacy and security of what you enter
Everything runs in your browser. See the privacy notice.
We review Spring Boot, JVM and gateway setups. See the services, the API capacity calculator or the retry simulator.
Message us on LinkedIn