如何检查linux为jvm分配的堆大小

时间:2022-07-11 07:19:12

I have apache-tomcat as my web server. I want to check what heap size is allocated for jvm by linux. Also from where, I can modify it.

我有apache-tomcat作为我的web服务器。我想检查一下linux为jvm分配的堆大小。也从哪里,我可以修改它。

4 个解决方案

#1


5  

You can easily check the heap size memory allocation using JConsole, if you have a path to your jre/jdk set up correctly on the system you should be able to start it with command jconsole from anywhere.

您可以使用JConsole轻松检查堆大小内存分配,如果您在系统上正确设置了jre / jdk的路径,则应该可以从任何位置使用命令jconsole启动它。

For managing your heap memory allocation you can have a look here: http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html

有关管理堆内存分配的信息,请查看此处:http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html

#2


18  

A simple way on Linux is to run the following:

Linux上的一个简单方法是运行以下命令:

ps -ef |grep tomcat

ps -ef | grep tomcat

Look for the starting and maximum JVM memory:

查找起始和最大JVM内存:

-Xms1024m -Xmx4096m

-Xms1024m -Xmx4096m

In this case it is allocating 1G on startup and the Maximum is 4G.

在这种情况下,它在启动时分配1G,最大值为4G。

#3


0  

The heap size used by Tomcat is defined in its configuration.

Tomcat使用的堆大小在其配置中定义。

This is the place where you can both check and change it.

这是您可以检查和更改它的地方。

If you're unsure about where this configuration is saved, I'd suggest looking at the Tomcat documentation where this is explained together with all configuration values.

如果您不确定此配置的保存位置,我建议您查看Tomcat文档,其中包含所有配置值。

#4


0  

If you need more information from the server but cannot log into it interactively (or don't have a GUI or JMX set up etc) you can include javamelody in your POM file/libs and it will create a page at host:8080//monitoring with all kinds of good information, including heap size, GC statistics and permgen size.

如果您需要来自服务器的更多信息但无法以交互方式登录(或者没有设置GUI或JMX等),您可以在您的POM文件/ libs中包含javamelody,它将在主机上创建一个页面:8080 //监控各种好的信息,包括堆大小,GC统计和permgen大小。

This is NOT a safe thing to leave running in a production environment - if you need it all the time at least lock it down!

在生产环境中运行并不是一件安全的事情 - 如果你一直需要它,至少要锁定它!

#1


5  

You can easily check the heap size memory allocation using JConsole, if you have a path to your jre/jdk set up correctly on the system you should be able to start it with command jconsole from anywhere.

您可以使用JConsole轻松检查堆大小内存分配,如果您在系统上正确设置了jre / jdk的路径,则应该可以从任何位置使用命令jconsole启动它。

For managing your heap memory allocation you can have a look here: http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html

有关管理堆内存分配的信息,请查看此处:http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html

#2


18  

A simple way on Linux is to run the following:

Linux上的一个简单方法是运行以下命令:

ps -ef |grep tomcat

ps -ef | grep tomcat

Look for the starting and maximum JVM memory:

查找起始和最大JVM内存:

-Xms1024m -Xmx4096m

-Xms1024m -Xmx4096m

In this case it is allocating 1G on startup and the Maximum is 4G.

在这种情况下,它在启动时分配1G,最大值为4G。

#3


0  

The heap size used by Tomcat is defined in its configuration.

Tomcat使用的堆大小在其配置中定义。

This is the place where you can both check and change it.

这是您可以检查和更改它的地方。

If you're unsure about where this configuration is saved, I'd suggest looking at the Tomcat documentation where this is explained together with all configuration values.

如果您不确定此配置的保存位置,我建议您查看Tomcat文档,其中包含所有配置值。

#4


0  

If you need more information from the server but cannot log into it interactively (or don't have a GUI or JMX set up etc) you can include javamelody in your POM file/libs and it will create a page at host:8080//monitoring with all kinds of good information, including heap size, GC statistics and permgen size.

如果您需要来自服务器的更多信息但无法以交互方式登录(或者没有设置GUI或JMX等),您可以在您的POM文件/ libs中包含javamelody,它将在主机上创建一个页面:8080 //监控各种好的信息,包括堆大小,GC统计和permgen大小。

This is NOT a safe thing to leave running in a production environment - if you need it all the time at least lock it down!

在生产环境中运行并不是一件安全的事情 - 如果你一直需要它,至少要锁定它!