开发者

Specify optimal minimum and maximum heap size for JBoss

开发者 https://www.devze.com 2023-03-01 14:16 出处:网络
I have a web application that I want to deploy for production on a 开发者_开发百科Linux machine. The machine will run on JBoss 4.2.3 and in front of it will be the latest version of Apache Web Server

I have a web application that I want to deploy for production on a 开发者_开发百科Linux machine. The machine will run on JBoss 4.2.3 and in front of it will be the latest version of Apache Web Server (using mod_jk). That's the only two applications residing on the machine. The server has 1.7GB RAM. I would appreciate some information or reference on how can I find the optimal minimum (-Xms) and maximum (-Xmx) heap size for JBoss on this production environment.

Regards


A good way to find optimal heap size is to use VisualVM (http://hillert.blogspot.com/2010/01/remote-profiling-of-jboss-using.html) and load test. This allows you to visualize your heap usage under load plus when and how often garbage collection is taking place. Pick a number like these gents have suggested(in your case somewhere between 700mb and 1024mb) put your instance under load and watch the memory profile. I'd suspect you'll find 1.7GB to be insufficient for most production applications. This usually manifests itself as a spiky cpu chart line from lots of gc thrashing, poor response times, and/or outofmemoryerrors. The point is you won't know for sure until you test.


Well, that generally depends on the load of each application as well the OS, but I'd set the max heapsize to 1024 or 1280. Just have a look on how much the OS and Apache are using + some buffer for spikes.


Every application is going to have different requirements, so it's going to be hard to give an optimal answer for your situation. Generally however I've found that allocating 60% of the server memory toward the JVM heap works well when the server is only running Apache and Java.

So I'd recommend -Xms1g -Xmx1g for your server. That should leave sufficient room for OS overhead, Apache and Java memory that goes beyond the heap (namely the permanent generation and the stack size times the number of threads). You should experiment and profile your application to verify it's stable.

0

精彩评论

暂无评论...
验证码 换一张
取 消