Reputation: 1736
I'd like to know how to determine the heap size required for a standalone app as well as a webapp running on a tomcat server.
How to determine the same after deployment on the server.
Thanks.
Upvotes: 7
Views: 4085
Reputation: 5233
Rule suggested by IBM for Sizing the Java heap , it is for IBM SDK but i dont think there would be much difference in these settings for other SDK's.
Size your Java heap so that your application runs with a minimum heap usage of 40%, and a maximum heap usage of 70%.
Upvotes: 4
Reputation: 61568
You can start with profiling the memory usage. The JDK (6 upwards) has its Visual VM for example. A tool I personally prefer is the Eclipse Memory Analyzer, originally from SAP, now open. You can analyze heap dumps or hook it up to a java process of your choice.
To programmatically create heap dumps you can use this
Upvotes: 5
Reputation: 2414
we use the -Xloggc:gc-log.txt
and -XX:+PrintGCdetails
option on the VM and let it run for a while (days) with hig Xmx settings and then you can use GCViewer to render a diagram from the log and get an idea of when how much RAM was consumed, i.e. whether there were peaks, limits reached, loads of GCs slowing down the App, etc.
Upvotes: 1