English 中文(简体)
如何优化JVM以利用更少的资源
原标题:How to Optimize JVM to utilize less resources

我使用Apache tomcat 7.02作为服务器。我使用sphinx4创建了一个应用程序,并将其部署在Apache tomcat服务器上。由于这个sphinx4应用程序需要大量内存才能执行。因此,为此,我分配了大量内存作为java堆空间(export CATALINA_OPTS=“-Xms1536m-Xmx1536m”)。我部署服务器的服务器是一个64位系统,上面有Debian Lenny,还有2Gb的RAM。我创建了一个Servlet,向它发布数据,获取结果。。。当我为10个用户运行它时,大约需要8分钟来处理,但如果我同时为100个用户运行,它会在tomcat状态中显示这一点

Free memory: 37.0 MB Total memory: 1484.81 MB Max memory: 1484.81 MB

我也试过使用System.gc(),但它没有gud。那么,有什么方法可以检查JVM的内存状态并在需要时释放它吗?

最佳回答

您需要确定资源的使用位置。我建议您使用内存探查器并更改程序以减少内存消耗。

如果您使用的是64位JVM,您可以使用-XX:+UseCompressedOops来减少内存消耗(它使用32位引用而不是64位引用)

编辑:如果您无法调整您的应用程序,则可能值得考虑升级您的服务器。一台24 GB服务器的成本约为1800英镑,可以在不更改代码的情况下扩展到1000个用户。)

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签