The mistake of optimization!

Source: Internet
Author: User

If the load soars at the start of the JVM and then gradually becomes normal, we often suspect that JIT compilation is a problem.

Increasing the number of cores compiled at startup is definitely an effective workaround, but when this parameter is set at startup, it does not require so many cores to work when it is running properly.

You cannot dynamically reduce this parameter if the JVM has already started.

So using-xx:+tieredcompilation for layered compilation can alleviate this problem, in fact there are many case use this parameter to solve the JVM startup load high problem.


However, if you turn on hierarchical compilation, C1,C2 's compilation results will take up more codecache than non-layered C2 results, and will likely exceed the default 96m space.

Even if there is not a full codecache, if the amount of space for recycling is large, such as 30m of free space after recovery, but the code is only hundreds of bytes to a few K per compilation, the free space will be severely fragmented.


Even more pathetic is the JDK7, which maintains the free space is a linked list, query to a specific size of the continuous space function Largest_free_block () is locked, with a lock function to access a huge listing,

The results are conceivable.


In other words, if you accidentally use the JDK7 version without patches, open the-xx:+tieredcompilation parameter, it can not be optimized, but because Argest_free_block () consumes the entire CPU.


For details, see: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8006952

The reason for this bug, it is one of our application stepped on this ray, the application was-xx:+tieredcompilation parameters dragged dead.


Because it is a virtual machine, our solution now is to dynamically allocate more cores to the virtual machine at startup to accelerate JIT compilation and restore the number of virtual machine cores to normal after startup.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The mistake of optimization!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.