Skip to content

Improving startup time

onetom edited this page Dec 29, 2014 · 6 revisions

Improving startup time

tl;dr

export BOOT_JVM_OPTIONS="-client 
-XX:+TieredCompilation 
-XX:TieredStopAtLevel=1 
-Xmx2g 
-XX:+UseConcMarkSweepGC 
-XX:+CMSClassUnloadingEnabled 
-Xverify:none"

Background

JVM startup time is a complex topic. While some JVM options can speed startup, they may also have a negative impact on other things like the ability to profile, overall GC performance, or security. For simplicity, the boot executable sets no JVM options by default. Leiningen does set options, which is why boot will feel slower for new users coming from Leiningen. We may want to reevaluate this decision in the future. Recent versions of JRuby provide a --dev option that sets JVM options to their speediest values.

In the meantime, users can set options locally to significantly improve boot's startup time.

Alan's Tests

On 11/26/2014 I tried three different BOOT_JVM_OPTIONS using the following setup:

  • MacBookPro10,2 running OS X 10.10.1
  • Oracle JDK 1.8.0_25
  • boot 2.0.0-pre27

I started boot 10 times for each option value and averaged the results. The snippet I ran to test was:

for i in {1..10}; do time boot show -E; done &> results.txt
  • unset BOOT_JVM_OPTIONS
    • Average startup: 3.33s
    • Comment: No options.
  • export BOOT_JVM_OPTIONS="-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx2g -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
    • Average startup: 2.17s
    • Comment: typical Leiningen options
  • export BOOT_JVM_OPTIONS="-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx2g -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xverify:none"
    • Average startup: 1.75s
    • Comment: uses -Xverify:none which maybe is bad?

Onetom's Tests

Hardware

Model Identifier: MacBookPro10,2
Processor Name: Intel Core i5
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 3 MB
Memory: 8 GB

Default config

time env BOOT_JVM_OPTIONS= boot2
        3.80 real        10.69 user         0.56 sys

Most optimized

time env BOOT_JVM_OPTIONS="-client -Xmx2g -Xverify:none
  -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" boot2
        2.09 real         4.14 user         0.27 sys

References

Clone this wiki locally