JVM Heap, GC, and Connector Tuning for Tomcat 10.1
ColdFusion 2025 ships with Tomcat 10.1 and supports JDK 17 LTS. Proper JVM tuning is critical for application performance and requires ongoing testing and adjustment based on your specific workload characteristics.
JDK 17 LTS Baseline
ColdFusion 2025 recommends JDK 17 LTS for optimal performance and security. Verify your Java version:
java -version
JVM Configuration File
Edit the JVM configuration file to adjust heap size and garbage collection settings:
- Linux:
/opt/coldfusion/cfusion/bin/jvm.config
- Windows:
C:\ColdFusion2025\cfusion\bin\jvm.config
Baseline JVM Flags
Add these flags to your jvm.config file for optimal performance:
# Security and entropy -Djava.security.egd=file:/dev/urandom # G1 Garbage Collector (recommended) -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch # Heap dump on OOM -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/coldfusion/heapdumps # GC Logging -Xlog:gc*:file=/opt/coldfusion/logs/gc.log:time,uptime:filecount=5,filesize=20M
Heap Sizing Guidelines
Size your heap based on your application's memory requirements. Follow these guidelines to ensure optimal performance:
- Start with 1x your application's live set plus 30% headroom for growth
- Maintain at least 30% free heap during normal operation
- Prevent heap from reaching 70% capacity, as this triggers more frequent garbage collection cycles
- Set the minimum (-Xms) and maximum (-Xmx) heap to the same value to prevent dynamic resizing overhead
# Example: 4GB heap -Xms4096m -Xmx4096m
Garbage Collector Options
ColdFusion 2025 supports multiple garbage collectors:
- G1 GC (Recommended): Balanced throughput and pause times, good for most workloads
- Parallel GC: High throughput, longer pause times
- ZGC: Ultra-low latency, requires JDK 17+, experimental for CF
Tomcat Connector Tuning
Edit the server.xml
file to tune Tomcat connectors. The following are key settings you can configure in the Connector element:
<Connector port="8500" protocol="HTTP/1.1" maxThreads="200" acceptCount="100" connectionTimeout="20000" keepAliveTimeout="15000" maxKeepAliveRequests="100" />
- maxThreads: Maximum number of concurrent requests to handle (tune this based on your RPS and PMT data)
- acceptCount: Queue size for incoming requests when all threads are busy
- connectionTimeout: Number of milliseconds to wait for a request before timing out
- keepAliveTimeout: Number of seconds to keep idle connections alive before closing them
TLS Configuration
Disable legacy TLS versions and use modern cipher suites:
<Connector port="8500" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" sslProtocol="TLS" sslEnabledProtocols="TLSv1.2,TLSv1.3" />
Tuning Checklist
- JDK 17 LTS installed and verified
- G1GC enabled in jvm.config
- Heap sized appropriately for workload
- GC pause p95 under 250ms (monitor with PMT)
- Thread pool saturation under 80%
- No full GCs during normal load
- GC logging enabled for analysis
- TLS 1.0/1.1 disabled
Gotchas
- A heap that is too small causes frequent garbage collection, while a heap that is too large results in longer pause times
- Always test JVM changes under realistic load conditions with PMT monitoring to validate improvements
- GC tuning is an iterative process - change only one variable at a time and measure the impact
- Container environments may require different heap sizing strategies due to memory constraints
- Monitor for thread pool exhaustion, as it causes request queuing and subsequent timeouts
References
Need Help?
Convective specializes in JVM tuning and ColdFusion performance optimization. We've been doing it for over 20 years. Find out more.