Re: [PATCH] Added OpenJDK Zulu compact profile base images and example apps for each profile

2016-09-14 Thread Waldek Kozaczuk
I forgot to add the commit link that disabled ballooning -
https://github.com/cloudius-systems/osv/commit/e69fa2b6364da0c38068216eee4aeabeef82a3fa
.

On Wed, Sep 14, 2016 at 1:39 PM, Waldek Kozaczuk 
wrote:

> Here are usr.img (compressed I believe) and JRE (uncompressed) sizes in
> MBs:
>
>- compact1 - 33, 34 // scripts/build image=openjdk8-zulu-compact1
>- compact2 - 38, 47 // scripts/build image=openjdk8-zulu-compact2
>- compact3 - 43, 53 // scripts/build image=openjdk8-zulu-compact3
>- full openjdk8 - 73, 106 // scripts/build image=openjdk8-fedora
>
> As you can see compact1 JRE size is one third of the full one.
>
> Obviously you can only run Java code on specific compact profile JRE if it
> does not use java standard library classes outside of the available set as
> defined here - https://blogs.oracle.com/jtc/entry/a_first_look_at_compact.
> For example anything that requires XML needs compact2, anything that
> requires JMX requires compact3. Because of this reason ballooning feature
> to work requires compact3 as it is dependent on JMX (BTW I believe
> ballooning feature was disabled at some point per this commit so I am not
> sure if it still needs to be supported - kind of went on a tangent). Same
> way jolokia agent requires compact3.
>
> Java 9 (GA is supposed to be March 2017) is even more exciting as it comes
> with jlink tool (http://openjdk.java.net/jeps/282) that truly lets one
> build custom JREs (http://openjdk.java.net/jeps/220). The smallest with
> java_base one on Linux can be of around 20MB. I have been looking to see
> what would need to change in java folder and run_java to support it as for
> example extension class loader in gone in Java 9 and runjava relies on it
> right now.
>
> jlink --module-path 
> /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/jmods
> --add-modules java.base -G --output image // On my Mac I got 29MB image
> with stripped debug symbols
> jlink --module-path 
> /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/jmods
> --add-modules java.base -G -c --output image // On my Mac I got 21MB image
> with stripped debug symbols and compressed modules file
>
> Waldek
>
> On Wed, Sep 14, 2016 at 7:51 AM, Avi Kivity  wrote:
>
>>
>>
>> On 09/14/2016 07:15 AM, Waldemar Kozaczuk wrote:
>>
>>> The three apps openjdk8-zulu-compact* provide base images for Java 8
>>> compact profiles. Each of the 3 apps uses
>>> the https://github.com/wkozaczuk/openjdk8_compact_profiles_builder tool
>>> to build Java 8 compact profile JRE based
>>> on regular OpenJDK 8 JDK, in this case Zulu OpenJDK 8 builds (
>>> https://www.azul.com/products/zulu/).
>>>
>>> The other 3 apps are simple Java Hello apps that demonstrate usages of
>>> each of the base compact profiles.
>>>
>>>
>>>
>> Interesting; what's the reduction of the image size with this patch?
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [PATCH] Added OpenJDK Zulu compact profile base images and example apps for each profile

2016-09-14 Thread Waldek Kozaczuk
Nadav,

I thought about reusing java-example but this would not work without
changing java-example/module.py.

Currently java-example/module.py relies on api.run_java() which uses
io.osv.isolated.MultiJarLoader which obviously would not work as compact
profiles do not have code to support isolated mode. That is why I
refactored runjava to support nonisolated mode that can be used with any
compact profile.

default = api.run_java(classpath=['/java-example'], args=['Hello'])

The java-compactx_example/module.py sets command line by using java.so
directly.

default = api.run('/java.so -cp /java-example Hello')

Presumably another way to fix it would be to change java-example/module.py
to be like java-compactx_example/module.py and then the need for these
three extra example apps would disappear.


On Wed, Sep 14, 2016 at 10:36 AM, Nadav Har'El  wrote:

> Thanks, I committed these patches.
>
> I think that the three separate example apps were not strictly necessary,
> as one can do something like
>
>scripts/build image=openjdk8-zulu-compact1,java-example
>
> to build an image with this specific version of Java and the same Java
> example.
>
>
>
> --
> Nadav Har'El
> n...@scylladb.com
>
> On Wed, Sep 14, 2016 at 6:15 AM, Waldemar Kozaczuk 
> wrote:
>
>> The three apps openjdk8-zulu-compact* provide base images for Java 8
>> compact profiles. Each of the 3 apps uses
>> the https://github.com/wkozaczuk/openjdk8_compact_profiles_builder tool
>> to build Java 8 compact profile JRE based
>> on regular OpenJDK 8 JDK, in this case Zulu OpenJDK 8 builds (
>> https://www.azul.com/products/zulu/).
>>
>> The other 3 apps are simple Java Hello apps that demonstrate usages of
>> each of the base compact profiles.
>>
>> Signed-off-by: Waldemar Kozaczuk 
>> ---
>>  java-compact1-example/Hello.java|  5 +
>>  java-compact1-example/Makefile  |  7 +++
>>  java-compact1-example/module.py |  5 +
>>  java-compact1-example/usr.manifest  |  1 +
>>  java-compact2-example/Hello.java|  5 +
>>  java-compact2-example/Makefile  |  7 +++
>>  java-compact2-example/module.py |  5 +
>>  java-compact2-example/usr.manifest  |  1 +
>>  java-compact3-example/Hello.java|  5 +
>>  java-compact3-example/Makefile  |  7 +++
>>  java-compact3-example/module.py |  5 +
>>  java-compact3-example/usr.manifest  |  1 +
>>  openjdk8-zulu-compact-common/common.gmk | 37
>> +
>>  openjdk8-zulu-compact-common/latest.sh  |  3 +++
>>  openjdk8-zulu-compact1/Makefile | 11 ++
>>  openjdk8-zulu-compact1/latest.sh|  2 ++
>>  openjdk8-zulu-compact1/module.py| 24 +
>>  openjdk8-zulu-compact1/usr.manifest | 20 ++
>>  openjdk8-zulu-compact2/Makefile | 11 ++
>>  openjdk8-zulu-compact2/latest.sh|  2 ++
>>  openjdk8-zulu-compact2/module.py| 24 +
>>  openjdk8-zulu-compact2/usr.manifest | 20 ++
>>  openjdk8-zulu-compact3/Makefile | 11 ++
>>  openjdk8-zulu-compact3/latest.sh|  2 ++
>>  openjdk8-zulu-compact3/module.py| 26 +++
>>  openjdk8-zulu-compact3/usr.manifest | 20 ++
>>  26 files changed, 267 insertions(+)
>>  create mode 100644 java-compact1-example/Hello.java
>>  create mode 100644 java-compact1-example/Makefile
>>  create mode 100644 java-compact1-example/module.py
>>  create mode 100644 java-compact1-example/usr.manifest
>>  create mode 100644 java-compact2-example/Hello.java
>>  create mode 100644 java-compact2-example/Makefile
>>  create mode 100644 java-compact2-example/module.py
>>  create mode 100644 java-compact2-example/usr.manifest
>>  create mode 100644 java-compact3-example/Hello.java
>>  create mode 100644 java-compact3-example/Makefile
>>  create mode 100644 java-compact3-example/module.py
>>  create mode 100644 java-compact3-example/usr.manifest
>>  create mode 100644 openjdk8-zulu-compact-common/common.gmk
>>  create mode 100755 openjdk8-zulu-compact-common/latest.sh
>>  create mode 100644 openjdk8-zulu-compact1/Makefile
>>  create mode 100755 openjdk8-zulu-compact1/latest.sh
>>  create mode 100644 openjdk8-zulu-compact1/module.py
>>  create mode 100644 openjdk8-zulu-compact1/usr.manifest
>>  create mode 100644 openjdk8-zulu-compact2/Makefile
>>  create mode 100755 openjdk8-zulu-compact2/latest.sh
>>  create mode 100644 openjdk8-zulu-compact2/module.py
>>  create mode 100644 openjdk8-zulu-compact2/usr.manifest
>>  create mode 100644 openjdk8-zulu-compact3/Makefile
>>  create mode 100755 openjdk8-zulu-compact3/latest.sh
>>  create mode 100644 openjdk8-zulu-compact3/module.py
>>  create mode 100644 openjdk8-zulu-compact3/usr.manifest
>>
>> diff --git a/java-compact1-example/Hello.java
>> b/java-compact1-example/Hello.java
>> new 

Re: [PATCH] Added OpenJDK Zulu compact profile base images and example apps for each profile

2016-09-14 Thread Nadav Har'El
Thanks, I committed these patches.

I think that the three separate example apps were not strictly necessary,
as one can do something like

   scripts/build image=openjdk8-zulu-compact1,java-example

to build an image with this specific version of Java and the same Java
example.



--
Nadav Har'El
n...@scylladb.com

On Wed, Sep 14, 2016 at 6:15 AM, Waldemar Kozaczuk 
wrote:

> The three apps openjdk8-zulu-compact* provide base images for Java 8
> compact profiles. Each of the 3 apps uses
> the https://github.com/wkozaczuk/openjdk8_compact_profiles_builder tool
> to build Java 8 compact profile JRE based
> on regular OpenJDK 8 JDK, in this case Zulu OpenJDK 8 builds (
> https://www.azul.com/products/zulu/).
>
> The other 3 apps are simple Java Hello apps that demonstrate usages of
> each of the base compact profiles.
>
> Signed-off-by: Waldemar Kozaczuk 
> ---
>  java-compact1-example/Hello.java|  5 +
>  java-compact1-example/Makefile  |  7 +++
>  java-compact1-example/module.py |  5 +
>  java-compact1-example/usr.manifest  |  1 +
>  java-compact2-example/Hello.java|  5 +
>  java-compact2-example/Makefile  |  7 +++
>  java-compact2-example/module.py |  5 +
>  java-compact2-example/usr.manifest  |  1 +
>  java-compact3-example/Hello.java|  5 +
>  java-compact3-example/Makefile  |  7 +++
>  java-compact3-example/module.py |  5 +
>  java-compact3-example/usr.manifest  |  1 +
>  openjdk8-zulu-compact-common/common.gmk | 37
> +
>  openjdk8-zulu-compact-common/latest.sh  |  3 +++
>  openjdk8-zulu-compact1/Makefile | 11 ++
>  openjdk8-zulu-compact1/latest.sh|  2 ++
>  openjdk8-zulu-compact1/module.py| 24 +
>  openjdk8-zulu-compact1/usr.manifest | 20 ++
>  openjdk8-zulu-compact2/Makefile | 11 ++
>  openjdk8-zulu-compact2/latest.sh|  2 ++
>  openjdk8-zulu-compact2/module.py| 24 +
>  openjdk8-zulu-compact2/usr.manifest | 20 ++
>  openjdk8-zulu-compact3/Makefile | 11 ++
>  openjdk8-zulu-compact3/latest.sh|  2 ++
>  openjdk8-zulu-compact3/module.py| 26 +++
>  openjdk8-zulu-compact3/usr.manifest | 20 ++
>  26 files changed, 267 insertions(+)
>  create mode 100644 java-compact1-example/Hello.java
>  create mode 100644 java-compact1-example/Makefile
>  create mode 100644 java-compact1-example/module.py
>  create mode 100644 java-compact1-example/usr.manifest
>  create mode 100644 java-compact2-example/Hello.java
>  create mode 100644 java-compact2-example/Makefile
>  create mode 100644 java-compact2-example/module.py
>  create mode 100644 java-compact2-example/usr.manifest
>  create mode 100644 java-compact3-example/Hello.java
>  create mode 100644 java-compact3-example/Makefile
>  create mode 100644 java-compact3-example/module.py
>  create mode 100644 java-compact3-example/usr.manifest
>  create mode 100644 openjdk8-zulu-compact-common/common.gmk
>  create mode 100755 openjdk8-zulu-compact-common/latest.sh
>  create mode 100644 openjdk8-zulu-compact1/Makefile
>  create mode 100755 openjdk8-zulu-compact1/latest.sh
>  create mode 100644 openjdk8-zulu-compact1/module.py
>  create mode 100644 openjdk8-zulu-compact1/usr.manifest
>  create mode 100644 openjdk8-zulu-compact2/Makefile
>  create mode 100755 openjdk8-zulu-compact2/latest.sh
>  create mode 100644 openjdk8-zulu-compact2/module.py
>  create mode 100644 openjdk8-zulu-compact2/usr.manifest
>  create mode 100644 openjdk8-zulu-compact3/Makefile
>  create mode 100755 openjdk8-zulu-compact3/latest.sh
>  create mode 100644 openjdk8-zulu-compact3/module.py
>  create mode 100644 openjdk8-zulu-compact3/usr.manifest
>
> diff --git a/java-compact1-example/Hello.java
> b/java-compact1-example/Hello.java
> new file mode 100644
> index 000..a605554
> --- /dev/null
> +++ b/java-compact1-example/Hello.java
> @@ -0,0 +1,5 @@
> +public class Hello {
> +public static void main(String[] args) {
> +System.out.println("Hello, World!");
> +}
> +}
> diff --git a/java-compact1-example/Makefile b/java-compact1-example/
> Makefile
> new file mode 100644
> index 000..8a385c9
> --- /dev/null
> +++ b/java-compact1-example/Makefile
> @@ -0,0 +1,7 @@
> +module: Hello.class
> +
> +%.class: %.java
> +   javac -target 7 -source 7 $^
> +
> +clean:
> +   rm -rf *.class
> diff --git a/java-compact1-example/module.py b/java-compact1-example/
> module.py
> new file mode 100644
> index 000..216cf35
> --- /dev/null
> +++ b/java-compact1-example/module.py
> @@ -0,0 +1,5 @@
> +from osv.modules import api
> +
> +api.require('openjdk8-zulu-compact1')
> +
> +default = api.run('/java.so -cp /java-example Hello')
> diff --git a/java-compact1-example/usr.manifest
> 

Re: [PATCH] Added OpenJDK Zulu compact profile base images and example apps for each profile

2016-09-13 Thread Dor Laor
On Tue, Sep 13, 2016 at 9:15 PM, Waldemar Kozaczuk 
wrote:

> The three apps openjdk8-zulu-compact* provide base images for Java 8
> compact profiles. Each of the 3 apps uses
> the https://github.com/wkozaczuk/openjdk8_compact_profiles_builder tool
> to build Java 8 compact profile JRE based
> on regular OpenJDK 8 JDK, in this case Zulu OpenJDK 8 builds (
> https://www.azul.com/products/zulu/).
>
> The other 3 apps are simple Java Hello apps that demonstrate usages of
> each of the base compact profiles.
>

This is a really cool contribution. Nice!


>
> Signed-off-by: Waldemar Kozaczuk 
> ---
>  java-compact1-example/Hello.java|  5 +
>  java-compact1-example/Makefile  |  7 +++
>  java-compact1-example/module.py |  5 +
>  java-compact1-example/usr.manifest  |  1 +
>  java-compact2-example/Hello.java|  5 +
>  java-compact2-example/Makefile  |  7 +++
>  java-compact2-example/module.py |  5 +
>  java-compact2-example/usr.manifest  |  1 +
>  java-compact3-example/Hello.java|  5 +
>  java-compact3-example/Makefile  |  7 +++
>  java-compact3-example/module.py |  5 +
>  java-compact3-example/usr.manifest  |  1 +
>  openjdk8-zulu-compact-common/common.gmk | 37
> +
>  openjdk8-zulu-compact-common/latest.sh  |  3 +++
>  openjdk8-zulu-compact1/Makefile | 11 ++
>  openjdk8-zulu-compact1/latest.sh|  2 ++
>  openjdk8-zulu-compact1/module.py| 24 +
>  openjdk8-zulu-compact1/usr.manifest | 20 ++
>  openjdk8-zulu-compact2/Makefile | 11 ++
>  openjdk8-zulu-compact2/latest.sh|  2 ++
>  openjdk8-zulu-compact2/module.py| 24 +
>  openjdk8-zulu-compact2/usr.manifest | 20 ++
>  openjdk8-zulu-compact3/Makefile | 11 ++
>  openjdk8-zulu-compact3/latest.sh|  2 ++
>  openjdk8-zulu-compact3/module.py| 26 +++
>  openjdk8-zulu-compact3/usr.manifest | 20 ++
>  26 files changed, 267 insertions(+)
>  create mode 100644 java-compact1-example/Hello.java
>  create mode 100644 java-compact1-example/Makefile
>  create mode 100644 java-compact1-example/module.py
>  create mode 100644 java-compact1-example/usr.manifest
>  create mode 100644 java-compact2-example/Hello.java
>  create mode 100644 java-compact2-example/Makefile
>  create mode 100644 java-compact2-example/module.py
>  create mode 100644 java-compact2-example/usr.manifest
>  create mode 100644 java-compact3-example/Hello.java
>  create mode 100644 java-compact3-example/Makefile
>  create mode 100644 java-compact3-example/module.py
>  create mode 100644 java-compact3-example/usr.manifest
>  create mode 100644 openjdk8-zulu-compact-common/common.gmk
>  create mode 100755 openjdk8-zulu-compact-common/latest.sh
>  create mode 100644 openjdk8-zulu-compact1/Makefile
>  create mode 100755 openjdk8-zulu-compact1/latest.sh
>  create mode 100644 openjdk8-zulu-compact1/module.py
>  create mode 100644 openjdk8-zulu-compact1/usr.manifest
>  create mode 100644 openjdk8-zulu-compact2/Makefile
>  create mode 100755 openjdk8-zulu-compact2/latest.sh
>  create mode 100644 openjdk8-zulu-compact2/module.py
>  create mode 100644 openjdk8-zulu-compact2/usr.manifest
>  create mode 100644 openjdk8-zulu-compact3/Makefile
>  create mode 100755 openjdk8-zulu-compact3/latest.sh
>  create mode 100644 openjdk8-zulu-compact3/module.py
>  create mode 100644 openjdk8-zulu-compact3/usr.manifest
>
> diff --git a/java-compact1-example/Hello.java
> b/java-compact1-example/Hello.java
> new file mode 100644
> index 000..a605554
> --- /dev/null
> +++ b/java-compact1-example/Hello.java
> @@ -0,0 +1,5 @@
> +public class Hello {
> +public static void main(String[] args) {
> +System.out.println("Hello, World!");
> +}
> +}
> diff --git a/java-compact1-example/Makefile b/java-compact1-example/
> Makefile
> new file mode 100644
> index 000..8a385c9
> --- /dev/null
> +++ b/java-compact1-example/Makefile
> @@ -0,0 +1,7 @@
> +module: Hello.class
> +
> +%.class: %.java
> +   javac -target 7 -source 7 $^
> +
> +clean:
> +   rm -rf *.class
> diff --git a/java-compact1-example/module.py b/java-compact1-example/
> module.py
> new file mode 100644
> index 000..216cf35
> --- /dev/null
> +++ b/java-compact1-example/module.py
> @@ -0,0 +1,5 @@
> +from osv.modules import api
> +
> +api.require('openjdk8-zulu-compact1')
> +
> +default = api.run('/java.so -cp /java-example Hello')
> diff --git a/java-compact1-example/usr.manifest
> b/java-compact1-example/usr.manifest
> new file mode 100644
> index 000..f62abc7
> --- /dev/null
> +++ b/java-compact1-example/usr.manifest
> @@ -0,0 +1 @@
> +/java-example/Hello.class: ${MODULE_DIR}/Hello.class
> diff --git a/java-compact2-example/Hello.java
>