Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12)

I was configuring Apache Tomcat on 64-Bit Linux OS and wanted to tune it for better performance. While searching the net for the same I came across JVM Performance Tuning by Andrig Miller its good start for tuning Java for better performance on machine with Large memory.

Everything went fine but for some reason the process was not able to make the use of HugePages. Did lot of googling but was able to find the answer why it was not using it and to top it up whenever I use to shut down the server I use to get following error:

Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12)

Hence tried to do the research on my own. First thing I did is reduce the heap size that I had defined by 1 GB which resolved both the issues (Initially I have define the heap size same as memlock defined in /etc/security/limits.conf). Other thing that you can do is set the memlock to unlimited. Thanks to Andrig Miller for the suggestion.

Edit /etc/security/limits.conf and change the memlock as follows:

soft memlock unlimited
hard memlock unlimited

Conclusion: Keep the Heap Size less than the memlock defined in /etc/security/limits.conf. Or set the memlock to unlimited in /etc/security/limits.conf

2 Comments

Leave a Reply

Your email address will not be published.


*


CommentLuv badge