Problems with TOMCAT 7

1

I have a web application mounted with Tomcat 7 on a server with Debian 7 OS, and a few days ago when I turn on the server the application raises perfectly but in less than 5 minutes it stops working, I realized that tomcat is consuming all the memory of the server, but in the configuration it has since consumes 2 gb and I am consuming the 4 that the server has. How can I fix the problem?. Greetings

this is the error in the catalina logs that I see java.lang.OutOfMemoryError

    
asked by Arnaldo Robaina 15.08.2017 в 14:33
source

1 answer

0

It is possible that the application needs more space for its own architecture. At present the applications use very large libraries, which load many classes and also make use of proxy and dynamic load of classes that make use of the PermGen space. This case occurs when the exception with the error occurs as soon as you start the web server or applications or when accessing the application as I think it is your case. To solve this problem it is enough to increase the maximum size of the PermGen type memory. In Java, there are several parameters to control the initial size and the maximum size that the virtual machine can take.

  • Xms128m : Start size of the Virtual Machine, the default value is 64Mb. If this value is increased, it eliminates the time it would take to increase the size in memory of the virtual machine if it were the case that more memory was needed, so it would increase the performance in cases that the application makes intensive use of memory.
  • Xmx128m : Maximum size of the Java virtual machine at 128Mb. If the application exceeds the maximum memory size marked by this parameter, the java.lang.OutOfMemoryError exception is thrown. Do not It is convenient to assign this parameter the maximum memory of the machine because if there is no physical memory left (for which use the operating system or other applications) can cause a true headache.

  • XX: PermSize = 128m: Start size of the PermGen type memory 128Mb Start the virtual machine with a higher value than the defect speeds application loading, especially in the case of applications that make intensive use of this type of memory (Spring, Hibernate ...).

  • XX: MaxPermSize = 128m: Maximum memory size of type PermGen to 128Mb The default value is 64Mb. If the application exceeds maximum memory size for this type that marks this parameter, the java.lang.OutOfMemoryError exception is thrown: PermGen space. The value required for this parameter is usually lower than heap-type memory.

If you want to specify a value other than 128Mb, which is used for all the parameters as an example to simplify, it would be enough to replace the value 128 of the parameter with the one you want, provided they are multiples of 2 (64, 128, 256, 512, 768, 1024, 2048 ...) An example of a configuration you could use would be:

JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx2048m -XX:PermSize=2048m -XX:MaxPermSize=2048m"
    
answered by 26.04.2018 в 23:00