This article is a mirror article of machine translation, please click here to jump to the original article.

View: 26139|Reply: 0

[Source] [Practice] Troubleshoot the problem of running a Java application on a Linux server and hanging up

[Copy link]
Posted on 9/9/2021 10:52:50 AM | | | |
Open the website of the dev environment in the morning, a menu list data is not loaded, and find that there is indeed a problem with the interface.

Log in to the server to view the Java applicationRedirect output files and log files, found that the last log time stayed at 21:15, as shown in the figure below:



Check the system logs

Sep  8 21:30:05 centos7-dev04 kernel: Out of memory: Kill process 32452 (java) score 84 or sacrifice child
Sep  8 21:30:05 centos7-dev04 kernel: Killed process 32452 (java), UID 0, total-vm:7016412kB, anon-rss:1421400kB, file-rss:0kB, shmem-rss:0kB



If you suspect that an application has been killed by Linux, you can also quickly troubleshoot it by using the following command:



To check the memory usage, the command is as follows:



Passtop command, and then type mkeys, sorted according to the memory used by the process, as shown in the figure below:

PID: The ID of the process
USER: The process owner
PR: The priority of the process, the smaller the priority, the more priority is to be executed
NInice: Value
VIRT: The virtual memory occupied by the process
RES: The physical memory occupied by the process
SHR: Shared memory used by the process
S: The state of the process. S indicates hibernation, R indicates running, Z indicates deadlock, and N indicates that the process priority value is negative
%CPU: The usage rate of CPU used by the process
%MEM: The percentage of physical memory and total memory used by the process
TIME+: The total CPU time consumed by the process after it starts, that is, the cumulative value of the CPU usage time.
COMMAND: The name of the process startup command



The reason why the application hung up was because the server was running out of memory, and Linux automatically killed the Java application according to some rules, after all, the Java application occupies a very large amount of memory.

You can check which Java application is specific by using the following command:



solution

1. Increase server memory
2. Limit memory usage for Java applications
3. Migrate some Java applications to other servers





Previous:Linux Overlay file system in Docker
Next:Two tools are recommended for analyzing the Docker image layer
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com