The micro-service reports the startup time by measuring the time between the main
method entry, and the callback notification when the HTTP server has started.
We can do a few runs of java -jar build/libs/openj9-howto-all.jar
and pick the best time.
On my machine the best I got was 639ms.
OpenJ9 offers both an ahead-of-time compiler and a class data shared cache for improving startup time as well as reducing memory consumption.
The first run is typical costly, but then all subsequent runs will benefit from the caches, which are also regularly updated.
The relevant OpenJ9 flags are the following:
-
-Xshareclasses
: enable class sharing
-
-Xshareclasses:name=NAME
: a name for the cache, typically one per-application
-
-Xshareclasses:cacheDir=DIR
: a folder for storing the cache files
Let us have a few run of:
$ java -Xshareclasses -Xshareclasses:name=sum -Xshareclasses:cacheDir=_cache -jar build/libs/openj9-howto-all.jar
On my machine the first run takes 1098ms, which is way more than 639ms!
However the next runs are all near 300ms, with a best score of 293ms which is very good for a JVM application start time.