By Simon501
I’ve changed /etc/default/tomcat7 to have Xms and Xmx of 2048m on a 4Gb server:
JAVA_OPTS=“-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xms2048m -Xmx2048m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/usr/share/tomcat7”
However I see tomcat7 with a VIRT of 4575652 and a RES of 1.150g in “top”.
And I thought I understood virtual memory and the JVM :-(
Any help would be greatly appreciated. Thanks.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
So I would recommend you to use the pmap PID :)
Thanks gonchik,
I actually found out that along with the stack and static/code segments the main culprit was glibc’s use of “arenas” for memory allocation.
The default is to allocate 8 x 64Kb spaces per CPU. So in my case that was a whole gigabyte of unexpected RAM use.
This can be tuned by setting the environment variable MALLOC_ARENA_MAX within the startup scripts of Tomcat and the JVM.
The more “arenas” the better the memory allocation concurrency but I have found little difference in my application from the default 8 to a value of 1. I guess it depends how often the JVM needs memory.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.