Java Services cpu100% resolution sharing
backdrop
A recent task is to optimize an exported function, but click on the function found that the program for a long time no reaction, after a period of time there is a reaction, by viewing the monitoring of the service found that the service cpu continues to 100% of the situation, the following share my processing plan and process
Processing process
1. Program cpu monitoring chart
2. Locate the situation where the cpu usage is found to be 100%, but problems exist on both nodes. In this case, check the cpu status
a. Log in to the server and run the top command to check the cpu usage
-- This image is not 100% screenshot
b. Run the to-hp [pid] command to check the cpu usage of a thread
We can see that 506 and 856 are higher
c. Execute printf "%x\n" [thread id] to convert the thread id into hexadecimal, and +0x before the prefix, the purpose is to find the corresponding thread specific information in the thread log, the highest cpu when I got the thread hexadecimal 0x1a8
d. Run jstack [pid] > jstack.txt
e. Run 0x1a8 obtained in step c to query jstack.txt
The thread log found that this thread is actually a GC thread, which means that the existence of fullgc caused the cpu to continue to be too high, and fullgc is caused by large objects, which thinks that there are large objects in the system.
f. Check the memory status of the jvm
A large object was found on the memory snapshot
g. View program logs
The timing task was found to be running, and the same class as the large object was found in the class
e. Find the cause. The scheduled task queries more than 200,000 pieces of data to the object at one time, causing the fullgc to shut down the scheduled task, and the service recovers
peroration
The reason for this problem is that fullgc causes the cpu usage to be too high, and many of the exceptions of high cpu are occasional, so it is not easy to troubleshoot, because basically you can only see which threads are faulty when 100% occurs.
The above is the Java service cpu100% solution process to share the details, more information about Java service cpu100% please pay attention to other related articles Script home!
Related article
-
ssm integration shiro usage details
This article mainly introduces the ssm integration shiro use details, the article through the example code introduction is very detailed, for everyone's study or work has a certain reference learning value, the need of friends below with the small series to study together2021-04-04 -
Description of the Mybatis-plus global id generation policy
This article mainly introduces the Mybatis-plus global id generation strategy detailed, has a good reference value, hope to help you. If there are mistakes or incomplete areas, please feel free to comment2022-01-01 -
vue+ java implements a multi-level menu recursion effect
This article mainly introduces the vue+ java multi-level menu recursion effect, this article gives you a very detailed introduction through the example code, has a certain reference value, the need of friends can refer to the next2019-12-12 -
Java converts bytes to hexadecimal code sharing
We know that in java, a byte is a byte, that is, eight bits of binary; Four bits can represent a hexadecimal bit, so a byte can be converted to two hexadecimal bits. Let's take a look at the specific method in detail.2016-01-01 -
Use Java to complete the Socket file transfer mode
This article mainly introduces the use of Java to complete the Socket file transfer method, has a good reference value, I hope to help you, if there are mistakes or not considered completely, hope to give advice2023-09-09 -
Talk briefly about line breaks in Java programs
Line breaks in Java programs are generally represented by "\n", which is an escape character that represents line breaks. Depending on the operating system, the actual representation of newlines may be different, and this article will briefly talk about their differences and use2023-03-03 -
How to implement WebSocket in Java
websocket protocol is a new network protocol based on TCP, it realizes the full duplex communication between the browser and the server - allows the server to actively initiate information client,websocket is a persistent protocol,http is a non-persistent protocol, the following article mainly introduces how to use Java to achieve WebSo cket related information, the need of friends can refer to the next2023-05-05 -
Java example explains the implementation of enumeration enum
The essence of enumeration method is to search for the correct solution from all candidate answers, enumeration algorithm is simple and rough, his violent enumeration all possible, try all the methods as far as possible, the article introduced by example code is very detailed, for everyone's study or work has a certain reference learning value, the need for friends to learn together with small series2022-06-06 -
A second to understand whether java is value passing or reference passing
This article mainly introduces the java value transfer or reference transfer of the relevant knowledge, this article through a few examples to give you a very detailed introduction, for everyone's study or work has a certain reference value, need friends can refer to it2020-06-06 -
EL calls Java methods _ Dynamic node Java Academy Collation
Simply put, we in a class of a method, can use EL to call, this can be called by EL expression method called EL function, but this way must meet two requirements, which two points, we can refer to the following article2017-07-07
Latest comments