- Plesk Onyx for Linux
It is needed to tune Tomcat server settings.
How can it be done?
It is possible to perform by adjusting JAVA_OPTS parameter in Tomcat configuration file which is located under
To increase memory on a Tomcat server:
- Connect to the server via SSH ;
/etc/tomcat/tomcat.conffile with the favorite text editor;
Find JAVA_OPTS parameter:
CONFIG_TEXT: # You can pass some parameters to java here if you wish to
Change its value to the desired one. For example, to increase it to 3GB (3072MB), the value should be changed as follows. Where
-Xmsis minimum heap size - 3GB and the
-Xmxmaximum heap size - 3GB:
CONFIG_TEXT: JAVA_OPTS="-Xms3072m -Xmx3072m -XX:MaxPermSize=1536m"
Alongside with memory limit settings, add javaagent parameter in
CONFIG_TEXT: # Use JAVA_OPTS to set java.library.path for libtcnative.so
JAVA_OPTS="-Xms3072m -Xmx3072m -XX:MaxPermSize=1536m - javaagent:/path/to/newrelic.jar -example.com.appserver_port=<PORT> -Djavamelody.disabled=true"
Restart Tomcat service:
# service tomcat restart
The maximum heap size
Xmxis the maximum memory Tomcat can use. It should be set to a value which leaves enough free memory for the server itself to run and any other services you may have on the server. However, please note that the actual memory Tomcat uses will be a bit higher than the size of
The minimal heap size,
Xms, is the amount of memory allocated at startup. It should be equal to the
Xmxvalue in most cases. It will help to avoid having the costly memory allocation process running because the size of the allocated memory will be constant all the time.
The memory where classes are stored permanently,
MaxPermSizeshould allow Tomcat to load your applications' classes and leave spare memory from the
Xmxvalue for the instantiation of these classes. If you are not sure how much memory your applications' classes require, then you could set the
MaxPermSizeto half the size of
Xmxas a start — 1536 MB in our example.