Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 207282
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Java team <java@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Andrew Cowie <andrew@operationaldynamics.com>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 207282 depends on: Show dependency tree
Bug 207282 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2008-01-24 13:39 0000
Apparently there is something in Sun's JVM called "Class Data Sharing", which
involves preloading the rt.jar classes and writing a memory image of them down
to disk, which is later mmaped as read-only and thus able to be shared memory
between running VMs, with a view to saving memory across a system and (more to
the point) reducing start-up time for systems running `java -client`.

The referenced pages mention that Sun's "installer" builds classes.jsa on the
target machine at installation, but it describes the (undocumented) option to
build it yourself as necessary,

# java -client -Xshare:dump

It writes classes.jsa to the JRE's system directory, so you'll need to be root.

My own local testing showed a small but noticeable startup speed improvement.
Perhaps others could try this and report.

AfC

------- Comment #1 From Krzysiek Pawlik 2008-01-24 13:54:01 0000 -------
There's no Client VM for amd64 for example.

------- Comment #2 From Vlastimil Babka (Caster) 2008-01-24 13:58:44 0000 -------
Nice idea though, we just need to come up with nice USE flag name + description
(the long description in metadata.xml would probably help here). The flag would
be obviously masked on amd64 because nelchael is right.

------- Comment #3 From Andrew Cowie 2008-01-24 22:24:55 0000 -------
For what it's worth, by all appearances the thing just (politely) fails if the
VM doesn't support it (Try `java -server -Xshare:dump` to see what I mean);
could just include it in the ebuild; if it works it works, if not, no biggie.
Not so sure you need a whole USE flag for it.

Incidentally, more testing has shown the startup benefit is definitely
significant, and the simple fact of page sharing between VMs is exciting.

If you want to see it using the shared data, try:

$ java -client -verbose:class -Xshare:off HelloWorld

(ie, the normal state of affairs) vs

$ java -client -verbose:class -Xshare:on HelloWorld

(force it, and compare what it says when loading classes)

AfC

P.S. I've always forced my build and launcher systems to specify -client; most
people thought I was weird for it as it was the "default"; interestingly on my
current system the `java` front end has decided that -server is the default.

------- Comment #4 From Alistair Bush 2008-01-25 05:14:49 0000 -------
(In reply to comment #3)
> Not so sure you need a whole USE flag for it.

we would have to be able to support the default option, as we don't know the
side effects.  Plus we could always enable the flag by default and then ppl
could disable it if they really wanted to.

> 
> Incidentally, more testing has shown the startup benefit is definitely
> significant, and the simple fact of page sharing between VMs is exciting.
> 

Numbers, we need numbers  (well, I want numbers)


Poor me and my amd64 vms :(

------- Comment #5 From Alistair Bush 2008-01-25 05:23:47 0000 -------
For reference, here is some doco's

http://java.sun.com/javase/6/docs/technotes/guides/vm/class-data-sharing.html

------- Comment #6 From Andrew Cowie 2008-01-25 06:11:39 0000 -------
(In reply to comment #5)
> For reference, here are some docs

That is the URL I put in the bug's URL field :)

AfC

------- Comment #7 From Andrew Cowie 2008-02-15 05:47:50 0000 -------
Turns out that Sun's 1.6 JRE also supports Class Data Sharing for it's server
VM. (as I found out when I ran `java -Xshare:dump` and forgot to supply
`-client` onyl to have it succeed and write:

/opt/sun-jdk-1.6.0.04/jre/lib/i386/server/classes.jsa

Running again as `java -client -Xshare:dump` resulted in:

/opt/sun-jdk-1.6.0.04/jre/lib/i386/client/classes.jsa

being created. Huh.

AfC

------- Comment #8 From Vlastimil Babka (Caster) 2008-03-26 22:04:27 0000 -------
I just noticed the emul-linux-x86-java:1.5 ebuilds do this, and a bit of search
revealed that we already did it in 1.5 JDK's (client only) until it disappeared
for some unknown reason in 1.5.0.09...

------- Comment #9 From Vlastimil Babka (Caster) 2008-03-26 22:06:40 0000 -------
(In reply to comment #7)
> Turns out that Sun's 1.6 JRE also supports Class Data Sharing for it's server
> VM. (as I found out when I ran `java -Xshare:dump` and forgot to supply
> `-client` onyl to have it succeed and write:

Not on amd64 :(

gehinom ~ # GENTOO_VM=sun-jre-bin-1.6 java -Xshare:dump
Error occurred during initialization of VM
Dumping a shared archive is not supported on the Server JVM.
gehinom ~ # GENTOO_VM=sun-jre-bin-1.6 java -client -Xshare:dump
Error occurred during initialization of VM
Dumping a shared archive is not supported on the Server JVM.

But we can add it for x86.

------- Comment #10 From Vlastimil Babka (Caster) 2008-03-27 20:28:22 0000 -------
OK, it's added in sun-jdk, sun-jre-bin (for x86) and the emul-linux package
(amd64). In 1.6 for both client and server, in 1.5 for client only. JRE's
already had it for client VM because the construct.sh script creates it - just
added to 1.6 JRE's for server VM. Moved it from construct.sh to the ebuild.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug