How to determine the ideal size for an Metaspace for java 8

Rishikesh Darandale :

We are migrating our web application from Java 7 to Java 8. We had defined the PermSize jvm param arguments.

Since Java 8 will ignore this parameters, this are none of use. Metaspace is introduced in Java 8 and default size of it is unlimited(limited to physical memory) with dynamic growth.

My question is do I need to figure out the best values for my web application for metaspace jvm params or default will be a good idea to use?

Update:

More on my web application: My web application is based on struts and spring frameworks. It usually takes 4k requests/min. This application is deployed on tomcat 8.5 and it does not host any other web application. But, there are multiple tomcat instances running on same virtual machine. The current -Xms and -Xmx values are set to 1g.

Absurd-Mind :

There are multiple things here that you can consider:

  1. Initial Metaspace Size: Do you see negative and measurable impact when starting up your application because the JVM has to resize the metaspace? Then you should probably set the minimum size. Still I would try to avoid this because this would be a setting that will be easily forgotten when the application grows. -XX:MetaspaceSize=<NNN>

  2. Maximum Metaspace Size: Do you want your application to fail when the metaspace grew to specific size? Or do you want to limit the resources the server takes in this regard? Then you should probably set a maximum size for the metaspace -XX:MaxMetaspaceSize=<NNN>

  3. Metaspace Free Ratio: Do you load many different classes dynamically? Then you could maybe define a free ratio on the metaspace so that always enough space for new classes is available and no resizing will be needed in critical situations. -XX:MinMetaspaceFreeRatio=<NNN> and -XX:MaxMetaspaceFreeRatio=<NNN>

My suggestion would be to stick to the defaults, test it and only react when there is a need to.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=465853&siteId=1