Should I set a MaxMetaspaceSize?

前端 未结 3 695
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 09:44

So, after asking this question, it quickly became clear that the important question was not \"how can I\", but \"should I\"?

We have customers that we are moving fro

3条回答
  •  执笔经年
    2020-12-05 10:31

    Just to air the opposite opinion, the case can be made to ALWAYS set the MaxMetaspaceSize. Grouping the world's entire set of applications into 10 (binary - think about it) groups allows a discussion of why. Remember though, setting the limit only controls when Garbage Collection (GC) of that space will occur.

    Group 01: Applications with all Non-Dynamic Classes

    This group puts you into the stabilized band referred to above. In this case, the size to set is fairly easy to determine (just as MaxPermSize was) and there won't be much, if any, GC anyway.

    Group 10: Applications with Dynamic Classes

    Given the proliferation of highly powerful third party libraries, isn't almost every application in this group anyway? Often you don't care if the library is Scala/Groovy/etc, it just does exactly what you want so it is used. What is the value of filling up Metaspace with the litter of dead (dynamic) classes? When GC does come, it will be expensive. I would rather limit the size, make GC more frequent (but less pause time for each), and more easily run multiple applications on the same hardware without having concerns about their individual metaspaces running into one another.

提交回复
热议问题