Customizing the Azure Site Java Runtime Environment (5)

Source: Internet
Author: User

Java 8underPermGen and Parameter setting

?

In the previous section, we customized the Java 8 environment using our test page to print out the JVM's basic parameters, but if we look at it ourselves, we will find that in Mxbeans, there is no information such as PermGen usage data, initial size, etc., even if we have set the size:

?

In Java 7 and previous versions, PermGen primarily stores information about the loaded classes, and if the settings are too small and the class fails to load, a OutOfMemory classic error may occur, in Java development in Azure website, The problem with custom settings for customers also involves permgen size customization.

So in Java 8, where's PermGen?

Let's take a look at the JVM's memory model, where the JVM's memory is divided into Heap memories and Non-heap Memory,heap, which mainly store some Java object information, and Non-heap Memory such as PermGen primarily stores some loaded Java classes and meta-data information.

In Java versions prior to Java 8, the Heap size can be set by MS, MX, and PermGen can be set in Java option by PermSize, Maxperm. One obvious problem with the previous JVM was that you set the ? Xx:maxpermsize oom ( out of Memory " Span style= "font-family: Song body; Background-color:white ">" error, of course, this design will appear in addition to oom bug and performance issues, such as:

http://bugs.java.com/view_bug.do?bug_id=6962931

Therefore, in the Java 8 design, Oralce and the Java community abandoned the PermGen, since then there is no permgen such a thing, but the metadata is still needed to save, so in Java 8, the metadata moved to local memory, called Metaspace of the place.

So for the end user, you do not have to meet oom because of PermGen, because all of your effective system memory can do metaspace, so you do not need to set up Metaspace, in a 64-bit system machine, The default metaspace initial size is 21MB, so what is the maximum? Theoretically, if your metadata is really very large, there are a lot of classes to load, so you can theoretically run out of all your effective system memory.

So is there any way to set or limit the size of the metaspace? Yes, Java provides two parameters to allow you to set the size of the metaspace if necessary:

–xx:metaspacesize : - Micro System default 21MB , you can set a larger number to avoid frequent Full GC

-xx:maxmetaspacesize: there is no limit in theoretical size, but you can set a limit value

?

back to our Azure website of the Java OPTS on the settings, in the Java 8 the environment inside PermSize It's useless, so Web. config the settings in can be simplified to:

Customizing the Azure Site Java Runtime Environment (5)

Related Article

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.