You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/10/05 18:48:42 UTC

[GitHub] alexkli opened a new issue #2836: [java runtime] Use Class Data Sharing

alexkli opened a new issue #2836: [java runtime] Use Class Data Sharing
URL: https://github.com/apache/incubator-openwhisk/issues/2836
 
 
   As described in [this article](http://mjg123.github.io/2017/10/02/JVM-startup.html), Java has a feature called [class data sharing (CDS)](https://docs.oracle.com/javase/8/docs/technotes/guides/vm/class-data-sharing.html) that allows to share common class data for different JVMs.
   
   This seems to be available since Java 5 (for JVM & JDK classes), and since Java 8 (u40) support application code as well (AppCDS).
   
   The current OW java action runtime [doesn't do anything](https://github.com/apache/incubator-openwhisk/blob/c036e0d1ee0be312dc5cc43cb2263ab3f0073b87/core/javaAction/Dockerfile#L38) like that yet.
   
   Benefits:
   * faster JVM startup time: from 120ms to 90ms for a simple hello world program (in that article)
   * reduces memory footprint when running multiple JVMs, apparently works in a containerized environment, should be great within OpenWhisk
   
   There are two steps for the basic CDS AFAICS:
   * prepare the shared class files once via `java -Xshare:dump`: could be done during the docker image build (?)
   * call the JVM with the flag `-Xshare:on` to enable CDS (there is some talk about `-Xshare:auto` becoming the default which I assume would enable it automatically if the prepared files are present)
   
   Leveraging AppCDS in OpenWhisk would mean to include the action Java code, and that might be tricky, as that can only be shared between containers with the same action code IIUC.
   
   Same for Ahead-Of-Time compilation (AOT), new in Java 9, mentioned in the article as well, which has a costly pre-compilation step (that should include the application aka action code), not sure how that could be done within OW. It would be beneficial if an action needs to scale up, i.e. you are starting many new Java containers with a particular action and you want to get the fastest startup time. But maybe pre-warming makes this less useful. One would have to be able to run that action specific pre-compilation up front, and that might require to embed it in the docker image IIUC, which in turn would require building it dynamically from OW, which sounds complex.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services