Two tomcats can only start one. How to solve the problem of insufficient memory?

problem:

A problem was encountered when the Alibaba Cloud server deployment project was demonstrated to customers.

After packaging the project and putting it in tomcat, the black window flashes back and an out of memory error is reported.

analysis:

First of all, I tested this package locally, and there was no problem. It happened when I put it on the server, and the problem was on the server. It was either a configuration or a memory allocation problem.

The server has 16G memory. In the task manager, the memory has never exceeded 50%. I heard from the leader that the bandwidth of the server is 5M, which is super low and the overall configuration is also low. So it is estimated that the error is caused by the garbage server. The next step is to try to solve it. .

solve:

There is already a project running in the server, and this project is in tomcat7. Someone is using this project, so I don't dare to do it casually. I am afraid that it will be broken, but it must be done. I will do it when no one is using it in the middle of the night.

Starting two tomcats will report insufficient memory, so I put my project on tomcat7, an unknown error occurred, and a certain jar package was reported not found (this problem can be solved by removing the jar package detection in the configuration file) , Does not exist, there is no problem with the package, this is for sure, forget it, don’t put a piece.

Adjust the tomcat8 configuration file, the catalina.bat file in the bin directory, edit and open:

@echo off add a line below

set JAVA_OPTS=-server -Xms256m -Xmx512m -XX:PermSize=128M -XX:MaxPermSize=1G

Constantly adjust the parameters, and test back and forth is OK.

Guess you like

Origin blog.csdn.net/numbbe/article/details/108710155