Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java HotSpot(TM) Client sharing vs no sharing

Tags:

java

I was looking at my JDK installations and I saw a difference between two installations:

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)

vs

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode, sharing)

And I was wondering what the difference between the sharing and not sharing state is.

I couldn't find a good answer other than "a speed difference", but no explanations why/what this is about.

like image 255
imacbest Avatar asked Aug 08 '17 09:08

imacbest


People also ask

What is Java HotSpot TM client?

The Java HotSpot Client VM The Java HotSpot Client Virtual Machine* serves as a replacement for both the "classic" virtual machine and the Just-in-time (JIT) compilers used by previous versions of the Java 2 SDK to offer improved runtime performance for applications and applets.

What is Java HotSpot mixed?

Mixed mode means Hotspot dynamically compiles Java bytecodes into native code when a number of criteria have been met, including the number of times the method has been run through the interpreter. Mixed runtime mode normally results in the best performance.

What does Java client do?

The Client VM compiler serves as an upgrade for both the Classic VM and the just-in-time (JIT) compilers used by previous versions of the JDK. The Client VM offers improved run time performance for applications and applets.


1 Answers

That's called Class Data Sharing, as described here; this only works for a Client VM.

Basically it is a way to speed-up the start-up time of the VM - the parsed classes are stored in a file and when the VM starts, it just reads that file (with already compiled classes), it also can be shared with other running VMs.

The shared build will contain a file jre\bin\client\classes.jsa and the other one will not.

Since java-8 you can add your own classes to that file - if I remember correctly and the native code (not the byte code) will be there for grabs.

I have not used Client VM's with this support - just read about it.

like image 182
Eugene Avatar answered Sep 25 '22 06:09

Eugene