1

We were testing with both HotSpot and OpenJ9 and it seems like both impose an overhead of about 40MB+ of off heap memory (checking in JConsole) even before loading a single class.

enter image description here

Is there a way to reduce this overhead?

Obviously I tried to limit all the different areas: -Xms10m -Xmx10m -XX:MaxMetaspaceSize=10m

Guy Korland
  • 9,139
  • 14
  • 59
  • 106
  • 2
    The overhead will depend on your application; e.g. how much code it loads. So you could reduce the overhead by making the application smaller. – Stephen C Jun 24 '20 at 07:45
  • Could you share how you measured this? Did you try out some things already? If so, what? Just checked task manager? Did you try to force a lower heap size? Was it able to boot with less memory still or did it crash? In general, the JVM favors speed over memory and will not directly free allocated bytes if not necessary. It can often work with much less memory, but performance might degrade. – Zabuzard Jun 24 '20 at 07:45
  • Added more info – Guy Korland Jun 24 '20 at 10:09
  • > Did you try out some things already? If so, what? Tried to limit with all the configurations I found > Just checked task manager? Checked both `ps` and jmx info > Did you try to force a lower heap size? Yes, didn't help > Was it able to boot with less memory still or did it crash? Booted successfully – Guy Korland Jun 24 '20 at 10:10
  • 1
    JDK version? Operating system? CPU architecture? Class data sharing enabled (if supported)? Is this “off heap memory” truly allocated memory or memory mapped I/O (which would be shared between JVMs)? – Holger Jun 24 '20 at 16:34
  • JDK - Tried on both OpenJ9 14 and OpenJDK 14. architecture- CPU x64 Class data sharing - not relevant. Is this “off heap memory” truly allocated memory or memory mapped I/O (which would be shared between JVMs)? - I don't know I didn't allocate it, it's part of the JVM bootstrap off heap memory – Guy Korland Jun 24 '20 at 17:06
  • 4
    [This answer](https://stackoverflow.com/questions/53451103/java-using-much-more-memory-than-heap-size-or-size-correctly-docker-memory-limi/53624438#53624438) explains what else takes memory besides Java Heap and Metaspace. And [this post](https://shipilev.net/jvm/anatomy-quarks/12-native-memory-tracking/) presents a series of experiments to reduce JVM footprint as much as possible. – apangin Jun 24 '20 at 17:10
  • Thanks I already tried of the things on the answer but I'll the rest too. Can you please reopen the question? – Guy Korland Jun 27 '20 at 19:07

0 Answers0