In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
JVM tuning summary is what, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.
JVM tuning tools
Jconsole : jdk comes with a simple function, but it can be used when the system has a certain load. There is a detailed tracking of garbage collection algorithms.
JProfiler: Commercial software that requires a fee. Powerful.
VisualVM: Comes with JDK, powerful and similar to JProfiler. Recommended.
memory leak
Memory leaks can generally be understood as system resources (all aspects of resources, heap, stack, thread, etc.) in the case of misuse, resulting in the use of resources can not be recycled (or not recycled), resulting in new resource allocation requests can not be completed, causing system errors.
Exception: java.lang.OutOfMemoryError: Java heap space occupied
The most typical memory leak is simply that all heap space is filled with garbage objects that cannot be collected, and the virtual machine cannot allocate new space.
Solution:
This method is also relatively easy to solve, generally according to the garbage collection before and after the comparison, at the same time according to the object reference situation (common collection object reference) analysis, basically can find the leak point.
Persistent Generation Occupied Exception:
java.lang.OutOfMemoryError: PermGen space
Description:
Perm space is full. Exception thrown because storage space could not be allocated for the new class. This exception wasn't there before, but it's more common today with Java reflection in heavy use. The main reason is that a large number of classes generated by dynamic reflection are continuously loaded, which eventually leads to the Perm area being filled up.
Even more frightening is that different classLoaders even use the same class, but will load it, equivalent to the same thing, if there are N classLoaders then he will be loaded N times. Therefore, in some cases, the problem is considered essentially unsolvable. Of course, there are not many cases where there are a large number of classLoaders and a large number of reflection classes.
Solution:
-XX:MaxPermSize=16m
Switch to JDK. JRocket, for example.
Stack overflow exception:
java.lang.StackOverflowError
Description:
This is not much to say, generally recursion did not return, or loop call caused
Thread Stack Full Exception:
Fatal: Stack size too small
Description:
There is a limit to the size of a thread in java. After JDK 5.0, this value is 1M. The data associated with this thread will be stored in it. But when the thread space is full, the above exception will occur.
Solution:
Increase thread stack size. - Xss2m。However, this configuration does not solve the fundamental problem, depending on whether there is a part of the code that causes leaks.
System memory is full exception:
java.lang.OutOfMemoryError: unable to create new native thread
Description:
This exception is caused by the fact that the operating system does not have enough resources to spawn this thread. When the system creates threads, in addition to allocating memory in the Java heap, the operating system itself needs to allocate resources to create threads. Therefore, when the number of threads reaches a certain level, there may be room in the heap, but the operating system cannot allocate resources, this exception occurs.
The more memory allocated to the Java virtual machine, the less resources remain in the system, so when the system memory is fixed, the more memory allocated to the Java virtual machine, the less threads the system can generate in total, and the relationship between the two is inversely proportional. At the same time, you can modify-Xss to reduce the space allocated to a single thread, or you can increase the total number of threads produced in the system.
Solution:
Redesign the system to reduce the number of threads.
If the number of threads cannot be reduced, reduce the individual thread size by-Xss. To be able to produce more threads.
Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.
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.