Setting -XX:+DisableExplicitGC in production: what could go wrong?

前端 未结 3 1404
一个人的身影
一个人的身影 2020-12-08 09:48

we just had a meeting to address some performance issues in a web application that is used to calculate insurance rates. The calculations are implemented in a C/C++-module,

3条回答
  •  时光说笑
    2020-12-08 10:36

    You are not alone in fixing stop-the-world GC events by setting the -XX:+DisableExplicitGC flag. Unfortunately (and in spite of the disclaimers in the documentation), many developers decide they know better than the JVM when to collect memory and introduce exactly this type of issue.

    I'm aware of many instances where the -XX:+DisableExplicitGC improved the production environment and zero instances where there were any negative side effects.

    The safe thing to do is to run your current production code, under load, with that flag set in a stress test environment and perform a normal QA cycle.

    If you cannot do that, I would suggest that the risk of setting the flag is less than the cost of not setting it in most cases.

提交回复
热议问题