How to speed up Java VM (JVM) startup time?

后端 未结 6 1243
时光说笑
时光说笑 2020-11-30 02:43

I am running tests that start multiple JVM processes. Summary startup time of JVMs is quite significant compared to time of actual tests that run inside JVM. How do I speed

6条回答
  •  余生分开走
    2020-11-30 03:07

    Why not load all the tests in one JVM ? Can you do one or more of the following ?

    1. load all the tests via a higher-level class ?
    2. specify the test classes in a list (config file) and load each in sequence via Class.forName() ?
    3. if isolation is important, you can create a different class loader per test

    If memory allocation is sizeable, it may speed things up by specifying the JVM memory startup size to the same figure as the maximum allocatable memory (-Xms vs -Xmx), which will save the JVM having to go back to the OS for more memory. However in this scenario I think that's unlikely to be the problem.

提交回复
热议问题