In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "how to query when the architecture goes wrong". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Who is the patient number (WHO)?
Take out the console diagnostic instrument and enter the top command to find out. I was surprised by the fact that the patient whose PID was 1878 took up more than 200% of the CPU.
The question is located, but who is the patient whose PID is 1878? is it really the watchdog that went online yesterday?
Although Da Liu has experienced the workplace for a long time, he is still quite nervous when investigating production problems. after all, this is the production environment.
When it was too late, I only saw a command input by Da Liu:
Ps-ef | grep 1878
Looking intently, it turned out that he was farting to see others, and the SMS service had nothing to do with the watchdog, and Da Liu suddenly calmed down a lot.
The pot found the master, in fact, at this time, Da Liu can throw this problem to the SMS development team, but what Da Liu likes to do most is not to throw the pot, but to break the casserole and dig to the end.
two。 What's wrong with the patient (WHERE)?
Why is the CPU occupied by patient 1878 so high?
Only on the dark console diagnostic equipment, Da Liu skillfully typed:
Jstack-l 1878 > > 1878 medical record .log
In this way, we can get a detailed list of the medical records of patient 1878, which can be used later.
Which part of patient 1878 went wrong?
When I didn't finish, I saw Da Liu enter one on the diagnostic instrument of the console:
Top-Hp 1878
The whiteboard and black words list all the organ information of patient 1878.
Seeing the result, I was surprised that the organ with PID code 8721 occupied more than 100% of CPU.
Doubt arises spontaneously, what is this PID code 8721 organ, is it the head, the eyes, or the arms and legs? The PID columns displayed in these organs are all nicknames, and they are all so good at camouflage, how can they reveal their true colors?
Fortunately, Big Liu has a great trick, with the help of the demon mirror algorithm, skilled input:
Printf "% x\ n" 8721
If it really makes the organ code-named 8721, the real identity is actually 2211 of the respiratory tract, no wonder the patient has been out of breath and out of breath.
At this stage, it is still impossible to prescribe the right medicine to the case, ah, and it is still necessary to further diagnose what happened to 2211 of the respiratory tract, resulting in patient 1878 being out of breath and out of breath.
Only saw on the black console diagnostic equipment, big Liu flew again in the input:
Grep 2211-A20 1878. Log
The diagnostic results are then displayed on the diagnostic instrument.
Big Liu, who had memorized a lot of pots, was delighted to see the diagnosis result, and saw at a glance that it was the problem of using HashMap in the case of high concurrency (please find Google and Baidu by yourselves, so you won't go deep into it here), and finally put aside the clouds to see the blue sky.
3. How to prescribe the right medicine (HOW)?
Under the operation of Da Liu without the slightest muddle, the diagnosis of patient 1878 was over, and the pot was completely broken.
Specializing in the art industry, Da Liu can solemnly tell SMS developer colleagues the specific reasons, catch the root of the disease, developer colleagues can also prescribe the right medicine to the case.
Have you arrived at the get of Da Liu's way of diagnosing problems? Big Liu himself is simply summarized as the three axes of 2W1H: who is the patient, where there is something wrong, and prescribe the right medicine to the case.
1. Who is the patient? (WHO)
Step 1: use the top command to find out the patient PID with the highest occupation of CPU.
Step 2: check the real identity of the patient through ps-ef | grep PID.
2. What's wrong with the patient? (WHERE)
The first step: use jstack-l PID > > PID.log to obtain the medical record of the information of each organ of the patient name.
Step 2: use top-Hp PID to get the nickname PID, which occupies the highest amount of CPU.
Step 3: use printf "% x\ n" PID to get the organ's real identity TID according to the organ nickname PID
Step 4: use grep TID-A20 pid.log to match the medical records according to TID to determine what went wrong.
3. If you catch the root of the disease, you can take out the medicine kit and prescribe the right medicine to the case. (HOW)
As a programmer, it is inevitable to encounter a lot of problems like this at work. In the face of the problem, if you bump like a headless fly and still don't know the reason, when the backpot is about to become a reality, you might as well try the diagnosis method of the three axes of 2W1H, which may help you quickly locate and solve the online problem. After all, the rapid solution to the production problem will minimize the loss.
That's all for "how to query if the architecture goes wrong". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.