Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common faults and Solutions of Linux system

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

This article is to share with you common Linux system failures and solutions. In the process of using the system, there will always be a variety of faults, so we need to constantly troubleshoot, so share with you to do a reference, let's take a look at the causes of system failures and solutions.

The causes of online Linux system failures usually include the following:

1. CPU utilization rate is too high

An application takes up a lot of CPU, which is usually caused by an endless loop, except that it is really computationally intensive. The troubleshooting techniques are as follows:

1) use the top command to locate the process that takes up high CPU. For example, the process PID41843 occupies too much CPU, which obviously has a problem and locates to the process id. Of course, if you want to observe only the CPU and memory and load of the process PID41843, you can use the command: top-p 41843

2) use the top command to locate the CPU occupied by each thread in the problem process. Use the command: top-p 41843-H

3) locate the problem code through the jstack command. For example, if you find that the CPU consumed by the thread PID41892 is too high, convert the PID to hexadecimal, where PID41892 is converted to hexadecimal to a3a4. Use the following command to locate the problem code: jstack 41892 | grep a3a4

Second, excessive memory consumption

In Java development, common exceptions and solutions are as follows:

Java.lang.OutOfMemoryError: PermGen space

The reason for the exception: if there is a lot of CLASS in the application, PermGen space errors are likely to occur. This error message occurs when WEB or APP uses a large number of third-party jar whose size exceeds the default size of jvm (4m).

Solution: adjust the size of PermSize and MaxPermSize, reduce the reuse of jar, reuse memory.

Java.lang.OutOfMemoryError: Java heap space

Reason for exception: in JVM, this exception information will be thrown if 98% of the time is spent on GC and the available Heap size is less than 2%. Tip: the maximum Heap Size should not exceed 80% of the available physical memory. Generally, the-Xms and-Xmx options should be set to the same, and the-Xmn should be set to the-XMX value of 1 to 4.

Steps for troubleshooting the cause of the exception:

1) use the jstat command to query gc. After locating the memory-intensive process PID through the top command, troubleshoot the GC of the process, and command: jstat-gccause 41843 2000

2) query the memory usage of the process entity class through the jmap command. If you find that gc is very frequent in step 1, you can use the jmap command to query the memory usage of the process entity class. Command: jmap-histo:live 41843 | head-n 100

3) query the usage of the process heap through the jmap command. If no problems are found above, you can take a look at the use of the new generation, the old generation and the permanent generation in the process. Command: jmap-heap 41843

If it is found that the frequent gc is due to a problem with the size of the allocation of the new generation, the old age, and the permanent generation, it can be solved by changing the setting.

Permanent solution: adjust the size of PermSize and MaxPermSize, reduce the reuse of jar and occupy memory.

The solution of the new generation and the old age is to adjust the size of Xms-Xmx-Xmn.

About the common Linux system failures and solutions to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report