4

Is there any best practice for Metaspace Size with WildFly?

Example, for the max heap memory I'd the following setup:

((Memory without Wildfly running) * 2) - (Total amount of available memory)

I know that Metaspace auto increase if I don't specify MaxMetaspaceSize, but is this a good practice?

Thanks in advance

Guilherme Bernardi
  • 490
  • 1
  • 6
  • 18
  • 1) Before you ask about Best Practice (again), consider this: http://www.satisfice.com/blog/archives/27. 2) Your example may work for you, but depending on the context it could be too conservative ... or too liberal in its use of memory. (And it doesn't take account of off-heap memory in general, not just metaspace.) 3) My recommendation? I won't give it because it is a statement of opinion, not fact. – Stephen C Oct 08 '18 at 12:48
  • there is - don't specify *anything* related to meta space parameters – Eugene Oct 08 '18 at 12:50
  • Thank you for your attention @StephenC and I read the article, it's a great one. I see your point and I partial agree that "Best Practice" topics depends of the context of your application so you need to test your application to find the suitable setup for it, but I believe that there are some default values or recommendations for almost everything, so the companies don't spent their time creating tunning recommendations or default recommendations... When I ask about 'best practices' it's just a start from the defaults so I could test and see if that's applies. But thanks for your opinion. – Guilherme Bernardi Oct 08 '18 at 13:07
  • @Eugene Thank you I keep searching here and I found the same recommentation in JasperWiki [jaspersoft-maxmetaspacesize-java8](https://community.jaspersoft.com/wiki/setting-maxmetaspacesize-java-8), I'll test here. – Guilherme Bernardi Oct 08 '18 at 13:10

1 Answers1

8

The WildFly application server sets the initial and maximum metaspace value in standalone.conf to 96 MB / 256 MB respectively as follows:

... -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m ... -Xmx512m ...

However, MaxMetaspaceSize usually needs to be much larger in large production applications as it needs to contain metadata for all loaded classes in the application. Setting it to half of the maximum heap size (-Xmx) as WildFly does seems a safe bet as it will be garbage collected as necessary by the JVM.

mrts
  • 16,697
  • 8
  • 89
  • 72