In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
After a period of time did not write a diary, today is free to write down, the following is jvm-related concepts and tuning, developers can usually read other books, such as prose, life aspects.
1.-XX:+PrintGC prints the relevant log every time GC is triggered
-XX:+UseSerialGC serial recovery
-XX:+PrintGCDetails 's more detailed GC log
-Xms heap initial value
-maximum available value of Xmx heap
Maximum available value of Xmn Cenozoic reactor
XX:SurvivorRatio is used to set the ratio of eden space to from/to space in the Cenozoic era.
-the proportion of new generation and old age of XX:NewRatio configuration is 1:2
With-XX:SurvivorRatio=eden/from=den/to
Summary: in practice, we can directly equate the initial heap size with the maximum heap size
The advantage is that you can reduce the number of garbage collections while the program is running, thus improving efficiency.
XX:SurvivorRatio is used to set the ratio of eden space to from/to space in the Cenozoic era.
2. Virtual machine stack overflow
Error cause: java.lang.StackOverflowError stack memory overflow
Stack overflow occurs in recursive calls, loop traversal is not possible, but recursive calls are generated in loop methods, and stack overflows also occur.
Solution: set the maximum thread call depth
-Xss5m sets the maximum call depth
3. The difference between memory overflow and memory leak
Java memory leak means that the memory garbage is not cleaned up in time, so that the system can no longer provide you with memory resources (memory resources are exhausted)
And Java memory overflow is that you ask to allocate more memory than the system can give you, the system can not meet the needs, so there is an overflow.
Memory overflow, which is easy to understand, indicates that the storage space is not large enough. It's like pouring too much water and overflowing from the top of the cup.
Memory leak, the principle is that the used memory space is not released in time, occupying memory for a long time, resulting in insufficient memory space and memory overflow.
4. Serial and parallel collectors
Serial collection: the default algorithm before JDK1.5 is that there is only one thread, and the program stops for a long time when performing garbage collection
Parallel collection: a system in which multiple threads perform garbage collection, which is suitable for throughput, and the system stops running during collection
5. Serial collector
Serial collectors are the oldest, most stable, and efficient collectors, which may produce long pauses and use only one thread to retrieve. Serial recycling is used in new generation and old age; new generation replication algorithm and old age mark-compression are used; Stop The World (service pauses) in the process of garbage collection.
6. A single-threaded collector, when performing garbage collection, must pause all other worker threads until its collection is finished.
Features: the utilization rate of CPU is the highest, and the pause time is the long waiting time for users.
Applicable scenarios: small applications
The serial garbage collector can be used with the JVM parameter-XX:+UseSerialGC.
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.