Thoughts on Java metaspace allocation in IdP 4
Simon Lundström
simlu at su.se
Mon Jan 18 08:59:24 UTC 2021
On Sat, 2021-01-16 at 00:08:55 +0100, Wessel, Keith wrote:
>Hi, all,
>
>In reading up on Java's move from perm space to metaspace, I'm learning that it's advisable in many cases to limit Java's amount of memory used for metaspace with something like:
>
>-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=1024m
>
>Those numbers are probably too large for Shibboleth, I'm guessing. But if not set, it sounds like the metaspace can be as large as Tomcat or Jetty let it be.
>
>The wiki doesn't seem to offer any advice on these settings. Are there recommended values? Or can I assume that the IdP's use of metaspace and Java's garbage collection with - XX:+UseG1GC are good enough?
I've never had reason to change them either. It's usually very large
apps which keeps a lot of compiled classes IIRC. And apps that load and
unload a lot of classes?
https://wiki.openjdk.java.net/display/HotSpot/Metaspace
Anyway, when in doubt measure it! As a one off use jconsole/jvisualvm
and for continuous production usage use a JMX exporter to export the
metrics to your metricsplatform. We use jmxtrans-agent[1] on all our
IDPs and most of our other Java apps and we love it.
In JConsole I'm pretty sure that metaspace is the "Non-Heap Memory
Usage" under the "Memory" tab. And in JMX the MBean would be
java.lang:type=Memory:NonHeapMemoryUsage.
BR,
- Simon
1, <https://github.com/jmxtrans/jmxtrans-agent>
____________________________________
Simon Lundström
Acting Technical Manager Identity management
IT Services
Stockholm University
SE-106 91 Stockholm, Sweden
www.su.se/english/staff-info/it
https://www.su.se/english/about-this-website/privacy-policy
More information about the users
mailing list