Search code examples
javajvm-hotspot

Java unexpected Stop The Worlds on a KVM


Does anybody also expirience the unexpected Stop The Worlds pauses in JVM (Java 7 and 8 Hotspot) running on a KVM? I think, due to the virtualization, other KVMs on the hardware could take processing time from my JVM. Is it possible? Could you solve the problem and how?

My garbage collector graphs look normal. A minor gc happens every 15 minutes, so I think it couldn't be the cause of the often STWs.


Solution

  • I suggest you run a JVM which does nothing by monitor jitter. e.g. MicroJitterSampler

    This will help baseline the jitter your system is getting. e.g. on a clean machine you might expect to get

    2us 78400
    3us 122703
    4us 345238
    6us 216098
    8us 78694
    10us    3977528
    14us    114495
    20us    4931
    30us    203
    40us    35
    60us    18
    80us    11
    100us   9
    140us   132
    200us   85
    300us   473
    400us   5
    1ms 24
    

    This is normalised as to the jitter per hour.

    With affinity you can get this much lower. On a virtualised machine you might expect to see 5 - 50 ms on an otherwise quiet machine.