-
-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK compact profile support #497
Comments
I have made some progress on trying to build and run an image with Java 8 compact profile more specifically compact1. Here is an output from running simple hello world example in Quemu on Mac: reated instance: capstan-java8-compact-example Can somebody shed light or point to some wiki page to why there is a need for class loader isolation and dependency on cglib? Maybe all that can be reworked so that RunJava does not depend on java.beans.* and cglib. Here is some info from the compact profile wiki: JMX and the JMX Remote API are proposed for compact3. It may be necessary to update the JMX API to avoid referencing types in java.beans that do not exist. In the case of the JMX Remote API then it may be necessary to downgrade support for the RMI-IIOP protocol to avoiding needing to include CORBA." |
@tgrabiec is more familiar with the details here, but to make a long story short: We wanted to be able to run several different Java programs on the same JVM and give those different programs some semblance of running on a different JVM - different class loaders, different loggers, and so on. This isolation feature was especially important when we had a shell and ssh written in Java running on every OSv instance, which is no longer the case, so if you only plan to run one Java application on OSv, I think your best bet would be to remove this isolation feature - and its depedency on cglib. We could have an alternative version of the RunJava code without isolation (which would more-or-less reverse @tgrabiec 's patches adding isolation), or perhaps it might be possible to have one code which supports both options. |
I managed to build custom compact profile1 capstan image and run a "hello world" app. Essentially I created an app directory under apps modeled after apps/openjdk8-fedora and adjusted Makefile to make it pull JRE custom compact profile1 tarballs from my personal S3 bucket. As far as custom compact profile goes I ended up building openjdk-1.8.0.92.b14 custom profile1 and doing following surgery on it:
All that I based on following advise from stackoverflow.com - http://stackoverflow.com/questions/23907728/how-to-use-log4j-in-embedded-jdk-compact-1-2-3 As you can see this hack is not ideal and makes me think what is the right path to move forward with support of compact profiles specifically and JVM (not only Java) apps on OSv platform in general given following:
Here are my questions regarding support of JVM apps on OSv going forward:
It seems there is a lot of complexity that may not be necessary anymore. I am very interested in simplifying that but I need some guidance as far as what to keep under /java and what can be removed. And there are possibly many reasons (optimizations like balooning) which may require some of this complexity going forward. Can @tgrabiec offer some help here? Also I have found an issue #623 which may get addressed if we simplify JVM support. |
On Wed, Jun 1, 2016 at 11:32 PM, wkozaczuk [email protected] wrote:
I didn't understand this question?
I am very interested in simplifying that but I need some guidance as far as
Indeed most of the stuff should be moved from java/ to modules/java. Also I have found an issue #623
|
I created pull request to address this issue. Please note that I have not had chance yet to find some official compact profile 1,2 or 3 JRE to write a unit test verifying that indeed one can run java app on any of these compact profile. I built JDK8 compact profiles myself and used for my one manual tests and things look good. Also please note that jolokia plugin/agent relies on JMX which is only part of compact profile 3 and up so probably this part will not work with compact profiles 1 and 2 and I did not verify that. I am also planning to work on reorganizing java folder and moving it to modules/java and modules/java-tests but that would be part of a different issue which maybe already exists. |
… bootstrap code under runjava cannot depend on java.beans.* that is not part of any of the compact profiles. More specifically runjava depends on cglib and asm java libraries that manipulate bytecode and rely on java.beans. Therefore the changes that are part of this commit essentially allow to bootstrap a JVM app in one of two modes: - old one which provides classloader and JUL log manager isolation between potential multiple apps and runjava code and apps that possibly targets multi-apps on single JVM in OSv and requires full JRE - new one which does NOT provide any classloader and JUL log manager isolation and targets single main method apps on JVM in OSv and allows using compact profile 1, 2 or 3 Following changes are part of this commit: * Added io.osv.isolated and io.osv.nonisolated packages under java/runjava and refactored ContextIsolator to create JvmApp, NonIsolatedJvmApp, RunNonIsolatedJvmApp, solatedJvmApp, NonIsolatedJvmApp * Changed java.cc and makefile to support producing two executable - old java.so that can run multiple JVM apps in isolated fashion (class loader, log manager, etc) and new java_non_isolated.so that can run single JVM app without any isolation of the former one * Changed java/jvm/java.cc to print which java class it uses to bootstrap - isolated or nonisolated one; fixed Makefile to properly handle building of java_non_isolated.so * Added java_non_isolated.so to modules/java-tests/usr.manifest * Added java_non_isolated test to test.py; modified testing.py to detect failure to start *.so * Added unit tests to test running non-isolated JVM app to tests-isolates Fixes cloudius-systems#497 Signed-off-by: Waldemar Kozaczuk <[email protected]>
…a bootstrap code under runjava cannot depend on java.beans.* that is not part of any of the compact profiles. More specifically runjava depends on cglib and asm java libraries that manipulate bytecode and rely on java.beans*. Therefore the changes that are part of this commit essentially allow to bootstrap a JVM app in one of two modes: - old one which provides classloader and JUL log manager isolation between potential multiple apps and runjava code and apps that possibly targets multi-apps on single JVM in OSv and requires full JRE - new one which does NOT provide any classloader and JUL log manager isolation and targets single main method apps on JVM in OSv and allows using compact profile 1, 2 or 3 Following changes are part of this commit: * Added io.osv.isolated and io.osv.nonisolated packages under java/runjava and refactored ContextIsolator to create Jvm, NonIsolatedJvm, RunNonIsolatedJvmApp, IsolatedJvm, RunIsolatedJvmApp classes * Changed java.cc and makefile to support producing two executable - old java.so that can run multiple JVM apps in isolated fashion (class loader, log manager, etc) and new java_non_isolated.so that can run single JVM app without any isolation of the former one * Changed java/jvm/java.cc to print which java class it uses to bootstrap - isolated or nonisolated one; fixed Makefile to properly handle building of java_non_isolated.so * Added java_non_isolated.so to modules/java-tests/usr.manifest * Added java_non_isolated test to test.py; modified testing.py to detect failure to start *.so * Added unit tests to test running non-isolated JVM app to tests-isolates Fixes cloudius-systems#497 Signed-off-by: Waldemar Kozaczuk <[email protected]>
…manager isolation in order to run JRE compact profiles. In order to run a JVM app using compact profile 1, 2 or 3 JRE the Java bootstrap code under runjava cannot depend on java.beans.* that is not part of any of the compact profiles. More specifically runjava depends on cglib and asm java libraries that manipulate bytecode and rely on java.beans*. Therefore the changes that are part of this commit essentially allow to bootstrap a JVM app in one of two modes: - old one which provides classloader and JUL log manager isolation between potential multiple apps and runjava code and apps that possibly targets multi-apps on single JVM in OSv and requires full JRE - new one which does NOT provide any classloader and JUL log manager isolation and targets single main method apps on JVM in OSv and allows using compact profile 1, 2 or 3 Following changes are part of this commit: * Added io.osv.isolated and io.osv.nonisolated packages under java/runjava and refactored ContextIsolator to create Jvm, NonIsolatedJvm, RunNonIsolatedJvmApp, IsolatedJvm, RunIsolatedJvmApp classes * Changed java.cc and makefile to support producing two executable - old java.so that can run multiple JVM apps in isolated fashion (class loader, log manager, etc) and new java_non_isolated.so that can run single JVM app without any isolation of the former one * Changed java/jvm/java.cc to print which java class it uses to bootstrap - isolated or nonisolated one; fixed Makefile to properly handle building of java_non_isolated.so * Added java_non_isolated.so to modules/java-tests/usr.manifest * Added java_non_isolated test to test.py; modified testing.py to detect failure to start *.so * Added unit tests to test running non-isolated JVM app to tests-isolates Fixes cloudius-systems#497 Signed-off-by: Waldemar Kozaczuk <[email protected]>
…manager isolation in order to run JRE compact profiles. In order to run a JVM app using compact profile 1, 2 or 3 JRE the Java bootstrap code under runjava cannot depend on java.beans.* that is not part of any of the compact profiles. More specifically runjava depends on cglib and asm java libraries that manipulate bytecode and rely on java.beans*. Therefore the changes that are part of this commit essentially allow to bootstrap a JVM app in one of two modes: - old one which provides classloader and JUL log manager isolation between potential multiple apps and runjava code and apps that possibly targets multi-apps on single JVM in OSv and requires full JRE - new one which does NOT provide any classloader and JUL log manager isolation and targets single main method apps on JVM in OSv and allows using compact profile 1, 2 or 3 Following changes are part of this commit: * Added io.osv.isolated and io.osv.nonisolated packages under java/runjava and refactored ContextIsolator to create Jvm, NonIsolatedJvm, RunNonIsolatedJvmApp, IsolatedJvm, RunIsolatedJvmApp classes * Changed java.cc and makefile to support producing two executable - old java.so that can run multiple JVM apps in isolated fashion (class loader, log manager, etc) and new java_non_isolated.so that can run single JVM app without any isolation of the former one * Changed java/jvm/java.cc to print which java class it uses to bootstrap - isolated or nonisolated one; fixed Makefile to properly handle building of java_non_isolated.so * Added java_non_isolated.so to modules/java-tests/usr.manifest * Added java_non_isolated test to test.py; modified testing.py to detect failure to start *.so * Added unit tests to test running non-isolated JVM app to tests-isolates Fixes cloudius-systems#497 Signed-off-by: Waldemar Kozaczuk <[email protected]>
…manager isolation in order to run JRE compact profiles. In order to run a JVM app using compact profile 1, 2 or 3 JRE the Java bootstrap code under runjava cannot depend on java.beans.* that is not part of any of the compact profiles. More specifically runjava depends on cglib and asm java libraries that manipulate bytecode and rely on java.beans*. Therefore the changes that are part of this commit essentially allow to bootstrap a JVM app in one of two modes: - old one which provides classloader and JUL log manager isolation between potential multiple apps and runjava code and apps that possibly targets multi-apps on single JVM in OSv and requires full JRE - new one which does NOT provide any classloader and JUL log manager isolation and targets single main method apps on JVM in OSv and allows using compact profile 1, 2 or 3 Following changes are part of this commit: * Added io.osv.isolated and io.osv.nonisolated packages under java/runjava and refactored ContextIsolator to create Jvm, NonIsolatedJvm, RunNonIsolatedJvmApp, IsolatedJvm, RunIsolatedJvmApp classes * Changed java.cc and makefile to support producing two executable - old java.so that can run multiple JVM apps in isolated fashion (class loader, log manager, etc) and new java_non_isolated.so that can run single JVM app without any isolation of the former one * Changed java/jvm/java.cc to print which java class it uses to bootstrap - isolated or nonisolated one; fixed Makefile to properly handle building of java_non_isolated.so * Added java_non_isolated.so to modules/java-tests/usr.manifest * Added java_non_isolated test to test.py; modified testing.py to detect failure to start *.so * Added unit tests to test running non-isolated JVM app to tests-isolates Fixes cloudius-systems#497 Signed-off-by: Waldemar Kozaczuk <[email protected]> Message-Id: <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
Java 8 introduced "compact profiles" which are stripped down versions of the JDK:
http://openjdk.java.net/jeps/161
We should provide an OSv image with one of the compact profiles to reduce the size of JDK-based VM images which currently weight at around 120 MiB. That's insanely large when compared to something like Node.js which has base images just under 20 MiB.
The text was updated successfully, but these errors were encountered: