It seems, for AWS Lambdas, that Java is noticeably slower than other supported languages when it comes to cold starts. Does JDK 11 have any performance enhancements, compared to JDK 8, that may improve the cold start time?
-
1GraalVM would improve it, not sure Java 11 alone would make a difference – OneCricketeer Nov 26 '19 at 20:22
2 Answers
Theoretically it should via application class-data sharing, it should reduce the startup time by a few seconds. Class-data sharing is enabled by the "--Xshare:on" when booting the JVM.
aws enable "--Xshare:on" by default for the J11 runtime, the only reason for enabling this flag would be for the case where they have generated an archive using the list of classes that comes with JDK.
Aplication Class Data Sharing for application classes was introduced first for J9 and was a commercial feature that only became available in OpenJDK 10.
If you wanted to test the effect of this for your lambda functions with OpenJdk 11 then you would run
java -Xshare:dump
then in your $JAVA_HOME/lib/server you should see the jdk archive classes.jsa as shown below
then you would run your tests with the flag
java -Xshare:on ....
and the jvm will load the jdk class from this archive
to run local lambda tests this collection of docker container is a good option
https://github.com/lambci/docker-lambda

- 991
- 13
- 26
Java 11 Runtime for AWS Lambda has even worse cold start than Java 8.
For small Lamda setup(256Mb) the difference is ~2sec. Please read https://medium.com/@filia.aleks/java-11-vs-8-performance-for-aws-lambda-c6e64ea6424

- 660
- 2
- 8
- 22