Home > Article > Operation and Maintenance > Tomcat error analysis under Linux
Problem phenomenon:
Tomcat (8.5.13) has deployed SuperMap iServer, and the number of concurrent users is around 100. After the system has been running for a while, the service crashes. Exception prompt
Problem analysis:
1. After seeing the prompt information in the log, I thought it was caused by insufficient system memory. So a monitoring script was added to the server (as shown below) to record the system memory and tomcat memory every 1 second.
After monitoring for a period of time, the exception reappeared. No memory exception was found in the log
2. After the memory is excluded, the idea turns to whether the number of processes is exceeded due to too many concurrent users?
1) View the resource limit parameters of the current Linux user ulimit -a
2) Among the above parameters, the one that attracts more attention is that a process can The maximum number of files opened, that is, open files. The maximum number of processes allowed to be created by the system is the max user processes parameter. We can use ulimit -u 4096 to modify the value of max user processes, but it will only take effect in the session of the current terminal. After logging in again, the system default value will still be used.
The correct way to modify it is to modify the value in the /etc/security/limits.d/90-nproc.conf file. Let’s first take a look at what this file contains:
$ cat /etc/security/limits.d/90-nproc.conf # Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning. * soft nproc 4096
We only need to modify the value 4096 in the above file.
After investigation, it was indeed due to the fact that the maximum number of processes set by the current user of the server was too small, causing the server to fail to create processes and crash.
Reference:
linux View the current process:
The above is the detailed content of Tomcat error analysis under Linux. For more information, please follow other related articles on the PHP Chinese website!