_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

JVM tuning for production servers

08. 05. 2011 1 min read CORE SYSTEMSdevelopment

Deploying a Java application on a server with default JVM settings is like buying a sports car and only ever driving in second gear. Proper configuration can be the difference between a 100ms and a 5-second response time.

Heap size

Basic rule: set -Xms and -Xmx to the same value. Dynamic heap size changes cause full GC pauses. On servers with 16 GB of RAM we typically allocate 8–10 GB for the JVM heap. PermGen: 256–512 MB for enterprise applications.

Garbage Collection — CMS

For web applications we use the Concurrent Mark Sweep collector. Parallel GC has better throughput, but its stop-the-world pauses can last seconds. CMSInitiatingOccupancyFraction=70 — CMS starts at 70% fill of the old generation.

GC logging

GC logging is enabled on every production server. We analyze it with GCViewer. Target metrics: minor GC under 50ms, full GC less than once per hour, total GC time under 5%.

Thread stack and monitoring

Reducing -Xss to 512 KB saves memory for more threads. JMX monitoring via Nagios: heap utilization, thread count, GC activity. Alert when heap exceeds 85%.

Summary

Xms = Xmx. CMS for web applications. GC logging always enabled. Monitor via JMX. Test under load on staging before production.

jvmjavaperformancegc
Share:

CORE SYSTEMS

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.

Need help with implementation?

Our experts can help with design, implementation, and operations. From architecture to production.

Contact us