开发者

Tomcat memory and virtual hosts

I have a VPS on which I serve Tomcat 6.0. 500mb memory was enough, when I had only two applications. Last week I deployed another web application and formed a new virtual host editing Tomcat server.xml. But the server responses slo开发者_高级运维w down, linux started to eat the swap. When I increased the memory 750 mb it become stable again. But memory is not so cheap so I won't be happy to pay 250 mb RAM for each additional application.

Is "250 mb additional memory need" for each web app normal? Is there any solution to decrease this cost? For example, does "to put common libraries of these applications to shared folder of Tomcat" have positive impact on Tomcat memory and performance?

Note: Deployed applications are web applications that use Spring, hibernate, sitemesh and related libraries, war file size totals up to 30 mb.

Thanks.


It's unlikely that this memory is being consumed by the Spring / Hibernate / etc. classes themselves. So the size of their .jar files isn't going to matter much. Putting these libraries in Tomcat's shared library directory would help save a bit of memory in that one copy of these classes would be loaded only, but that won't save much.

Isn't it simply more likely that your applications are just using this much memory for data and so forth? You need to use a profiler to figure out what is consuming the heap memory first. Until you know the problem, it's not much use in pursuing particular solutions.


I think you need to measure the memory consumption of the application. You can use JProfiler or Java6 build in profiling tools such as VisualVM and JHat (best way to start).

Check this link for more info: http://java.sun.com/developer/technicalArticles/J2SE/monitoring/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜