1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
CON4529 - JDK 9 Hidden gems - RainFocus · 2017-10-04 · JEP 243: Java-Level JVM Compiler...
Transcript of CON4529 - JDK 9 Hidden gems - RainFocus · 2017-10-04 · JEP 243: Java-Level JVM Compiler...
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved.
CON4529- JDK9 Hidden Gems
MikaelVidstedtDirector,JavaVirtualMachine,Oracle@MikaelVidstedt
SandhyaViswanathanSeniorStaffSoftwareEngineer,Intel
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
SafeHarborStatementThefollowingisintendedtooutlineourgeneralproductdirection.Itisintendedforinformationpurposesonly,andmaynotbeincorporatedintoanycontract.Itisnotacommitmenttodeliveranymaterial,code,orfunctionality,andshouldnotberelieduponinmakingpurchasingdecisions.Thedevelopment,release,andtimingofanyfeaturesorfunctionalitydescribedforOracle’sproductsremainsatthesolediscretionofOracle.
2
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
ProjectJigsaw
• JEP261:ModuleSystem• JEP200:TheModularJDK• JEP201:ModularSourceCode• JEP220:ModularRun-TimeImages• Plus– JEP260:EncapsulateMostInternalAPIs– JEP282:jlink:TheJavaLinker
ModularizetheJavaPlatform
3
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JEP282:jlink:TheJavaLinker• Createatoolthatcanassembleandoptimizeasetofmodulesandtheirdependenciesintoacustomrun-timeimageasdefinedinJEP220.Defineapluginmechanismfortransformationandoptimizationduringtheassemblyprocess,andforthegenerationofalternativeimageformats• Createacustomruntimeoptimizedforasingleprogram• JEP261defineslinktime asanoptionalphasebetweenthephasesofcompiletimeandruntime.Linktimerequiresalinkingtoolthatwillassembleandoptimizeasetofmodulesandtheirtransitivedependenciestocreatearun-timeimageorexecutable
4
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
java.corba
java.se
java.se.ee
java.transaction
java.xml.ws
java.sql
java.sql.rowset
java.xml.bind
java.jnlp
java.activation
java.desktop
java.management.rmi
java.xml.crypto
java.transfer
java.compiler java.rmi
java.xmljava.instrument java.logging
java.management
java.namingjava.scripting
java.security.jgss
java.base
java.prefs
java.security.sasl
java.xml.ws.annotation
java.smartcardio
JavaSEModules
5
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
java.corba
java.se
java.se.ee
java.transaction
java.xml.ws
java.sql
java.sql.rowset
java.xml.bind
java.jnlp
java.activation
java.desktop
java.management.rmi
java.xml.crypto
java.transfer
java.compiler java.rmi
java.xmljava.instrument java.logging
java.management
java.namingjava.scripting
java.security.jgss
java.base
java.prefs
java.security.sasl
java.xml.ws.annotation
java.smartcardio
JavaSEModules company.application
6
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
java.corba
java.se
java.se.ee
java.transaction
java.xml.ws
java.sql
java.sql.rowset
java.xml.bind
java.jnlp
java.activation
java.desktop
java.management.rmi
java.xml.crypto
java.transfer
java.compiler java.rmi
java.xmljava.instrument java.logging
java.management
java.namingjava.scripting
java.security.jgss
java.base
java.prefs
java.security.sasl
java.xml.ws.annotation
java.smartcardio
JavaSEModules company.application
7
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JavaCustomRuntime
8
java.sql
java.sql.rowset
java.activation
java.transferjava.xml
java.logging
java.naming
java.base
• IncludestheModularApplication
company.application
CustomImage~40Mb
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
• ExtendtheJARfileformattoallowmultiple,Java-release-specificversionsofclassfilestocoexistinasinglearchive
• WriteJDK-version-specificvariantsofthesamecodeintoasinglejarfile
JEP238:Multi-ReleaseJARFiles
9
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JEP247:CompileforOlderPlatformVersions
• EnhancejavacsothatitcancompileJavaprogramstorunonselectedolderversionsoftheplatform• javaccompilesagainstthemost-recentversionoftheplatformAPIs.ThecompiledprogramcanthereforeaccidentallyuseAPIsonlyavailableinthecurrentversionoftheplatform
10
javac --release <release>
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Agenda
• Tools&Libraries• JVM/Hotspot• Performance
MoreinformationonanyJEP:http://openjdk.java.net/jeps/{JEP#}
Searchfor:OpenJDK 9
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. 11
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Agenda
• Tools&Libraries• JVM/Hotspot• Performance
MoreinformationonanyJEP:http://openjdk.java.net/jeps/{JEP#}
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved.
Searchfor:OpenJDK 9
12
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Agenda
• Tools&Libraries• JVM/Hotspot• Performance
MoreinformationonanyJEP:http://openjdk.java.net/jeps/{JEP#}
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved.
Searchfor:OpenJDK 9
90+JEPsdeliveredinJDK9!
13
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Tools&Libraries
14
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
DEMOJEP222:jshellJEP269:ConvenienceFactoryMethodsforCollectionsJEP280:IndifyStringConcatenation
15
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JEP222:jshell:TheJavaShell(Read-Eval-PrintLoop)• Read-eval-print-loop(REPL)forJava• Simpleandpowerfulinteractiveprogramming– Gettingstartedaswellasadvancedusecases
• Bothatool(bin/jshell)andanAPI• Features– Tabcompletion– Helptextfromjavadocs!– Savetofile
16
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JEP269:ConvenienceFactoryMethodsforCollections• NewlibraryAPIstomakeitconvenienttocreatecollections– Newfactorymethodsforjava.util.{Set, List, Map}– Smallnumbersofelements– Decreasetheamountofcodeneededforcreatingsmallcollectionsandmaps
• Collectionsarenon-modifiable(immutable)– EnableslibrariesandJVMtooptimizeimplementation– Note:Contentsofactualelementscanstillbemodifiediftypeexposesmutators
Set<String> alphabet = Set.of("a", "b", "c");
17
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JEP280:IndifyStringConcatenation• ChangethestaticString-concatenationbytecodesequencegeneratedbyjavactouseinvokedynamiccallstoJDKlibraryfunctions• EnablesfutureoptimizationsofStringconcatenationwithoutrequiringfurtherchangestothebytecodeemittedbyjavac
18
public String example(String str) { return "Hello, " + str + "!"; }
public java.lang.String example(java.lang.String);Code:
0: new #2 // class java/lang/StringBuilder3: dup4: invokespecial #3 // Method java/lang/StringBuilder."<init>":()V7: ldc #4 // String Hello,9: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;12: aload_113: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;16: ldc #6 // String !18: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;21: invokevirtual #7 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;24: areturn
public java.lang.String example(java.lang.String);Code:
0: aload_11: invokedynamic #2, 0 // InvokeDynamic #0:makeConcatWithConstants:(Ljava/lang/String;)Ljava/lang/String;6: areturn
Invokedynamic bootstrapmethod
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
jshellWednesdayatJavaOne• JShell:AnInteractiveShellfortheJavaPlatform[CON3969]–Wednesday,Oct04,9:30am– 10:15am
• JShell:TheUltimateMissingTool[CON1188]–Wednesday,Oct04,10:45am– 11:30pm
• VisualJShell:JShellonSteroids[CON6166]–Wednesday,Oct04,12:45pm– 1:30pm
• ExploringJava9withREPL[CON3423]–Wednesday,Oct04,1:45pm– 2:30pm
19
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JVM/Hotspot
20
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JEP248:MakeG1theDefaultGarbageCollector• Goal:throughputand lowlatency• Regionbased– Collectsregionswithmostgarbagefirst
• Defaultpausetargetis200milliseconds– Higherpausegoal→ morethroughput,higherlatency– Lowerpausegoal→ lessthroughput,lowerlatency
• DefaultGCinJDK9(butinJDKsince6u14)– Adaptivestartofconcurrentcycle–Moreeffectivepauses
Selectregionstoevacuate
Evacuate
21
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
MoreonG1atJavaOne• The G1 GCinJDK9[CON6061]–Wednesday,Oct04,1:45pm- 2:30pm
• G1GC ConceptsandPerformanceTuning[CON4577]–Wednesday,Oct04,12:45pm- 1:30pm
22
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
GC:Deprecating&Removing• JEP291:DeprecatetheConcurrentMarkSweep(CMS)GarbageCollector– Toberemovedinfuturerelease
• JEP214:RemoveGCCombinationsDeprecatedinJDK8– iCMS,DefNew+CMS,CMSForeground,…
23
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
• CDS=ClassDataSharing– ApplicationCDSaddssupportforapplication(non-JDK)classes
• Preloadasetofclasses• Storeclassdatainsharedarchive– Think:OSsharedlibrary(lib*.so)
• ShareacrossJavainstances• NewinJDK9– Supportsinternedstringsinarchive
JEP250:StoreInternedStringsinCDSArchives
24
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Example:WebLogicServerBaseDomainApplicationClassDataSharing(AppCDS)Benefits
25
•Sharing & savings increases with every instance•10 instances ---> 10+% saving in total memory footprint
Footprint
Size
(MB)
- N
ote:
Log
arith
mic
!1
10
100
1000
10000
Unique Shared Total
4,137
66
4,073 4,652
20
4,634 No AppCDSAppCDS
Startup Time
Tim
e (s
)
0
1
2
3
4
5
6
7
8
9
10
11
12
No AppCDS AppCDS
7.7
11.4
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Example:WebLogicServerBaseDomainApplicationCDSBenefits
26
•Sharing & savings increases with every instance•With 10 instances there is ~10% saving in total memory footprint
Footprint
Size
(MB)
- N
ote:
Log
arith
mic
!1
10
100
1000
10000
Unique Shared Total
4,137
66
4,073 4,652
20
4,634 No AppCDSAppCDS
Startup Time
Tim
e (s
)
0
1
2
3
4
5
6
7
8
9
10
11
12
No AppCDS AppCDS
7.7
11.4
Beingopensourced!
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JEP295:Ahead-of-Time(AOT)CompilationJEP243:Java-LevelJVMCompilerInterface• DoeswithJITcompiledJavacodewhatAppCDS doeswithJavaclassdata– Pre-compiletosharedlibrary: jaotc --output libHelloWorld.so HelloWorld.class
– Useinsubsequentruns:java -XX:AOTLibrary=libHelloWorld.so HelloWorld
• ExperimentalfunctionalityintroducedinJDK9– Onlyonlinux-x64,otherplatformstofollow
• Benefits– Startupperformance– Reducestimetopeakperformance– Savesonfootprintbysharingacrossinstances
• Not-so-secretplan:useforenablingJava-basedJITcompiler– OpenJDKProject“Metropolis”aimstomoveJVMfunctionalitytoJava
27
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
java.basestaticAOTforC1java.basetieredAOTforC1+C2java.base+graalstaticAOTforC1+Graaljava.base+graaltieredAOTforC1+Graal(2)java.baseCDSjava.base+graalCDSforC1+Graal(2)
AOTBenefits:‘real’time(ms)torun`javaHelloWorld`
28
Lowerisbetter/faster
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
AOTatJavaOne
• HotSpot AOT Internalsand AOT +CDSPerformanceResults[CON7772]– Thursday,Oct05,10:45am- 11:30am
• FullSpeedAhead!(Ahead-of-TimeCompilationforJavaSE)[CON3738]– Wednesday,Oct04,2:45pm- 3:30pm
29
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JavaFlightRecorder(JFR)
• ModularizedandExtensibleAPIs– Fullysupported– Allowsuser-defined/customevents
• Producesdataevenin”bad”situations(e.g.out-of-memory)• Lotsofnewevents:module,safepoint,codecache,compilerinlining• Reducedfootprint(memory&disk)throughcompresseddatatypes
30
import jdk.jfr.* java -XX:+FlightRecorder
VisualizationusingJavaMissionControl(JMC)
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JavaFlightRecorder(JFR)
• ModularizedandExtensibleAPIs– Fullysupported– Allowsuser-defined/customevents
• Producesdataevenin”bad”situations(e.g.out-of-memory)• Lotsofnewevents:module,safepoint,codecache,compilerinlining• Reducedfootprint(memory&disk)throughcompresseddatatypes
31
import jdk.jfr.* java -XX:+FlightRecorder
VisualizationusingJavaMissionControl(JMC)
Beingopensourced!
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JavaFlightRecorder&JavaMissionControlatJavaOne
• JavaFlightRecorderinJDK9/Java Mission Control 6[HOL3018]– Wednesday,Oct04,1:30pm- 3:30pm
• DeepDiagnostics:APMandOracleJava Flight RecorderinOracleCloud[CON6916]– Wednesday,Oct04,2:45pm- 3:30pm
32
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
• JEP197:Segmentedcodecache– Dividedcodecacheintosegmentsreducingfragmentation
– Improve sweepandsafepointpausetimes– Benchmarksshowupto12%performanceimprovements
• JEP143:ImproveContendedLocking– SeriesoftransparentimprovementstocontendedJavalocks(think:synchronized)
– Optimizeslockacquisition,release,notify/notifyAll,…
33
OtherVM
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
OtherVM• JEP245:Validatecommandlineflags– Checktype&rangeofarguments– Provideusefulhints/errormessages
• JEP158/271:UnifiedLogging– CommonloggingframeworkforallcomponentsoftheHotspotJVM– Taggedmessageallowsforflexibleandfinegrainedcontrol
$ java -Xlog:gc=debug,class+load=info HelloWorld[0.012s][info][class,load] opened: lib/modules[0.018s][debug][gc ] ConcGCThreads: 1[0.018s][debug][gc ] ParallelGCThreads: 4[0.018s][debug][gc ] Initialize mark stack with 4096 chunks, maximum 16384[0.021s][info ][gc ] Using G1[0.025s][info ][class,load] java.lang.Object source: jrt:/java.base[0.025s][info ][class,load] java.io.Serializable source: jrt:/java.base[0.025s][info ][class,load] java.lang.Comparable source: jrt:/java.base<snip>
Usage: -Xlog[:[what][:[output][:[decorators][:output-options]]]]
34
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
• StoreInternedStringsinCDSArchives• ImproveContendedLocking• CompactStrings• ImproveSecureApplicationPerformance• LeverageCPUInstructionsforGHASHandRSA• TieredAttributionforjavac• JavadocSearch• MarlinGraphicsRenderer• HiDPIGraphicsonWindowsandLinux• EnableGTK3onLinux• UpdateJavaFX/MediatoNewerVersionof
GStreamer
• EnhancedDeprecation• Stack-WalkingAPI• ConvenienceFactoryMethodsforCollections• PlatformLoggingAPIandService• jshell:TheJavaShell(Read-Eval-PrintLoop)• CompileforOlderPlatformVersions• Multi-ReleaseJARFiles• Platform-SpecificDesktopFeatures• TIFFImageI/O\• Multi-ResolutionImages
• ProcessAPIUpdates• VariableHandles• Spin-WaitHints• DynamicLinkingofLanguage-
DefinedObjectModels• EnhancedMethodHandles• MoreConcurrencyUpdates• CompilerControl
• Jigsaw– ModularizeJDK
Behindthescenes
Newfunctionality
Specialized
• ParserAPIforNashorn• PrepareJavaFXUIControls&CSSAPIsfor
Modularization• ModularJavaApplicationPackaging• NewVersion-StringScheme• ReservedStackAreasforCriticalSections• SegmentedCodeCache• Ahead-of-TimeCompilation• IndifyStringConcatenation• UnifiedJVMLogging• UnifiedGCLogging• MakeG1theDefaultGarbageCollector• UseCLDRLocaleDatabyDefault• ValidateJVMCommand-LineFlagArguments• Java-LevelJVMCompilerInterface• DisableSHA-1Certificates• SimplifiedDocletAPI• DeprecatetheAppletAPI• ProcessImportStatementsCorrectly• AnnotationsPipeline2.0• ElideDeprecationWarningsonImport
Statements• MillingProjectCoin• FilterIncomingSerializationData• RemoveGCCombinationsDeprecatedin
JDK8• RemoveLaunch-TimeJREVersionSelection• RemovetheJVMTIhprofAgent• RemovethejhatTool
Housekeeping
Gone
• HTTP2Client• Unicode8.0• UTF-8PropertyFiles• ImplementSelectedECMAScript6
FeaturesinNashorn• DatagramTransportLayerSecurity
(DTLS)• OCSPStaplingforTLS• TLSApplication-LayerProtocol
NegotiationExtension• SHA-3HashAlgorithms• DRBG-BasedSecureRandom
Implementations• CreatePKCS12KeystoresbyDefault• MergeSelectedXerces2.11.0Updates
intoJAXP• XMLCatalogs• HarfBuzzFont-LayoutEngine• HTML5Javadoc
Newstandards
35
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Performance
36
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
PerformanceGemsinJDK9• VectorizationEnhancements• CompactStrings• MathLibraries• CryptoAcceleration• CompressionAcceleration• NewAPIs
37
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
PerformanceSetup• Platform:• Intel®Xeon®[email protected],384GBRAM
• Software:• OS:RedHatEnterpriseLinuxServerrelease7.2• JDK8:Java(TM)SERuntimeEnvironment(build1.8.0_144-b01)• JDK9:Java(TM)SERuntimeEnvironment(build9+181)
38
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
VectorizationEnhancements• Vectorizationextendedto512bitstobenefitfromAVX-512• Vectorizationsuperunroll• Reductionsupportinvectorloops• Supportforadditionalvectoroperations
39
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
AVX512and512-bitVectorization• AVX512supportedinIntelSkylakeserverandIntelXeonPhiprocessor• 512-bitwideinteger/floatingpointSIMD• 512-bit32ZMMregister• 16singleprecisionor8doubleprecisionFPoperations• 16int/32short/64byteintegeroperations
• JVM/JITSIMDvectorizationandcodegenerationextendedto512bits• JVM/JITarray/stringintrinsicmethodsoptimizedtobenefitfromAVX512
40
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. | 41
Example//DatastaticfinalintNUM=1026;staticint[]data1=newint[NUM],
data2=newint[NUM],data3=newint[NUM];
//LoopKernelpublicstaticvoidIntAdd(longX){
while(X>0){for(inti=0;i<NUM;i++){data1[i]=data2[i]+data3[i];
}X--;
}}
JVMOptionsScalar:-XX:-UseSuperWord
32ByteVector:-XX:UseAVX=2-XX:MaxVectorSize=32
64ByteVector:-XX:UseAVX=3-XX:MaxVectorSize=64
64ByteVectorAligned:-XX:UseAVX=3-XX:MaxVectorSize=64-XX:ObjectAlignmentInBytes=64
VectorizationExample
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JavaFloatingPointVectorizationPerformance
42
0%
20%
40%
60%
80%
100%
120%
140%
160%
180%
FloatAdd FloatMul FloadSub DoubleAdd DoubleMul DoubleSub
FPARITHMETIC
32ByteVector 64ByteVector 64ByteVectorAligned
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JavaIntegerVectorizationPerformance
43
0%
20%
40%
60%
80%
100%
120%
140%
160%
180%
200%
IntAdd IntAnd IntSub IntXor LongAdd LongAnd LongSub LognXor
INTEGEROPERATIONS
32ByteVector 64ByteVector 64ByteVectorAligned
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
JavaStreamsPerformanceprivate static void StreamTest(int[] out, int[] in1, int[] in2, int length) {
IntStream.range(0, length).forEach (i -> { out[i] = (in1[i] - in2[i]) * (in1[i] - in2[i]); });}
44
0%
20%
40%
60%
80%
100%
120%
140%
160%
180%
StreamTest
32ByteVector
64ByteVector
64ByteVectorAligned
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. | 45
VectorizationSuperUnroll
ScalarPreLoop
VectorMainLoop
ScalarPostLoop
ScalarPreLoop
UnrolledVector
MainLoop
VectorPostLoop
ScalarPostLoop
JDK8 JDK9
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Example:privatestaticintdot(int[]in1,int[]in2,intlength){intsum=0;for(inti=0;i<length;i++){sum+=in1[i]*in2[i];
}returnsum;
}
46
GeneratedCode:post_loop:vmovdqu320x10(%r8,%r13,4),%zmm0{%k1}{z}vpmulld0x10(%rbx,%r13,4),%zmm0,%zmm0{%k1}{z}vextracti64x4$0x1,%zmm0,%ymm1{%k1}{z}vpaddd%ymm0,%ymm1,%ymm1vextracti32x4$0x1,%zmm1,%xmm2{%k1}{z}vpaddd%xmm1,%xmm2,%xmm2vpshufd$0xe,%xmm2,%xmm3vpaddd%xmm3,%xmm2,%xmm2vpshufd$0x1,%xmm2,%xmm3vpaddd%xmm3,%xmm2,%xmm2vmovd%edx,%xmm3vpaddd%xmm3,%xmm2,%xmm3vmovd%xmm3,%edxadd$0x10,%r13dcmp%r10d,%r13djlpost_loop
ReductionSupportinVectorization
0%
50%
100%
150%
200%
250%
StreamTest
REDUCTIONPERFORMANCE
Scalar
32ByteVector
64ByteVector
64ByteVectorAligned
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Example:privatestaticvoidsqrt_kernel(double[]in1,intlength,double[]out){for(inti=0;i<length;i++){out[i]=Math.sqrt(in1[i]);
}}
47
GeneratedCode:post_loop:
vsqrtpd0x10(%r11,%rbx,8),%zmm0{%k1}{z}
vmovdqu64%zmm0,0x10(%r13,%rbx,8){%k1}
add$0x8,%ebx
cmp%r8d,%ebx
jlpost_loop
AdditionalVectorOperations
0%
100%
200%
300%
400%
500%
600%
SQRT
SQRTPERFORMANCE
JDK8
JDK9
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
CompactString
• JavasupportsUnicode(UTF-16)characterswhichuses2bytepercharacter
• CompactStringimprovesspaceefficiencyoftheStringandrelatedclasses• ChangestheinternalrepresentationofStringclasswhilepreservingcompatibility
• CharactersofStringencodedaseitherUTF-16orISO-8859-1/Latin-1
• Usesbytearrayinsteadofchararraytostorecharacterswithanencodingbytefield
• StringmethodsarehighlyoptimizedusingSIMDinstructionswherepossible• WithCompactStringabilitytodotwicetheoperationperiteration
48
JDK8StringClass{privatefinalcharvalue[];privateinthash;...
}
JDK9StringClass{privatefinalbyte[]value;privatefinalbytecoder;privateinthash;...
}
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
CompactStringPerformance
49
#instances #bytes
class JDK8 JDK9 JDK8 JDK9
[C(chararray) 1023926 1423 74387360 397656
[B(bytearray) 633 1030896 378376 49531032... ... ... ... ...
Total 2650985 2695483 123502352 100114688
Total#instancessimilarbetweenJDK8andJDK9
Total#bytesallocatedis~20%lesswithJDK9
SPECjbb2005*HeapDump
Peakthroughput~5%betterwithJDK9overJDK8
ComparingJDK1.8.0_144versusJDK-9releaserunningonIntel®Core™[email protected],32GBRAMwithLinux64-bit.JAVAOPTIONS="-server-showversion–Xmx20g–Xms20g-Xmn18g-XX:-UseAdaptiveSizePolicy-XX:+UseParallelOldGC-XX:ParallelGCThreads=4-XX:+UseLargePages-XX:+PrintFlagsFinal"
*SPECjbb2005istrademarkoftheStandardPerformanceEvaluationCorporation.Seehttp://www.spec.orgformoreinformation.
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
OptimizedMathLibraries• OptimizedTrigonometric&TranscendentalLIBMmethods• UsedinBigDatamachinelearning,FinancialoptionpricingandHPC
applications
50
0%
100%
200%
300%
400%
500%
600%
exp pow log log10 sin cos tan
MATHPERFORMANCE
JDK8
JDK9
0%
100%
200%
300%
400%
500%
600%
MonteCarlo BoxMuller BlackScholes
FSIPERFORMANCE
JDK8
JDK9
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
CryptoAcceleration• Javacryptographyarchitecture(JCA)definesaproviderframework
• SunJCEisthedefaultproviderintheOpenJDKandOracleJava
• IntelarchitecturesupportsAES-NI,CLMUL,ADCX/ADOXtoaccelerateCrypto
• OptimizedstubsforSunJCEprovider
51
0%
200%
400%
600%
800%
1000%
1200%
SHA256 SHA512 AESCTR AESGCMENC AESGCMDEC CryptoRSA
CRYPTOPERFORMANCE
JDK8
JDK9
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
CompressionAcceleration
• JDK8usesbundledzlibwhichcannotbeoverridden• JDK9supportspluggablezlib,applicationcanbenefitfromcompressionaccelerationseamlessly• SoftwareAcceleration:• http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/zlib-compression-whitepaper-copy.pdf• HardwareAcceleration:• https://01.org/intel-quickassist-technology
52
java.util.zip
JREzlibwrapper
zlib
libzip.so
java.util.zip
JREzlibwrapper
SoftwareAcceleration
strippedlibzip.so
HardwareAcceleration
JDK8 JDK9
Systemzlib
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
0%
50%
100%
150%
200%
250%
300%
350%
bib book1 book2 geo news obj1 obj2 paper1 paper2 paper3 paper4 paper5 paper6 pic progc progl progp trans
COMPRESSIONPERFORMANCE
JDK9
JDK9withSWAcc
CompressionwithSoftwareAcceleration
• Softwareaccelerationusingzlibfromhttps://github.com/jtkukunas/zlib• PerformanceshownforCalgaryCorpus*• SetLD_LIBRARY_PATH=Path_to_sw_accelerated_zlib
53
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
NewChecksumAPI• java.util.zipCRC32perRFC1952withpolynomial0x04C11DB7
• InJDK9anewAPIjava.util.zipCRC32CperRFC3720withpolynomial0x1EDC6F41
• JDK9alsohasanoptimizedimplementationusingIAcrc32cinstructionhttps://docs.oracle.com/javase/9/docs/api/java/util/zip/CRC32C.html
54
0%
20%
40%
60%
80%
100%
120%
140%
160%
2048 4096 8192 16384
CRC32CPERFORMANCE
JDK9CRC32
JDK9CRC32C
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
NewArrayProcessingAPI• LexicographicarraycompareAPIintroducedinJDK9forArraysclass• Arrays.comparemethodsforboolean,byte,char,short,int,long,floatanddoubletypes,e.g.
• publicstatic int compare(byte[] a,byte[] b)• publicstatic int compare(byte[] a,int aFromIndex,int aToIndex,byte[] b,int bFromIndex,int bToIndex)
• CorrespondingcompareUnsignedmethodsforbyte,char,short,int,longarrayshttps://docs.oracle.com/javase/9/docs/api/java/util/Arrays.html
• TargetedforBigDataapplicationslikeCassandrathatusearraysforkey• UnderlyingbasemethodoptimizedusingIASIMDinstructions
55
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
NewFMAAPI• Javasemanticsdoesn’tallowuseofFMAinstructionsforfloat/double
multiplyaddoperationcombination• AnAPIfmaisaddedtoJDK9aspartofjava.lang.MathandStrictMath• publicstatic double fma(double a,double b,double c)• publicstatic float fma(float a,float b,float c)https://docs.oracle.com/javase/9/docs/api/java/lang/Math.html#fma-double-double-double-
• TheintrinsicforIAusesthefmainstructionforunderlyingimplementation• BeneficialforHPCandMachineLearning
56
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Legal Disclaimer & Optimization Notice• INFORMATIONINTHISDOCUMENTISPROVIDED“ASIS”.NOLICENSE,EXPRESSORIMPLIED,BYESTOPPELOROTHERWISE,TOANY
INTELLECTUALPROPERTYRIGHTSISGRANTEDBYTHISDOCUMENT.INTELASSUMESNOLIABILITYWHATSOEVERANDINTELDISCLAIMSANYEXPRESSORIMPLIEDWARRANTY,RELATINGTOTHISINFORMATIONINCLUDINGLIABILITYORWARRANTIESRELATINGTOFITNESSFORAPARTICULARPURPOSE,MERCHANTABILITY,ORINFRINGEMENTOFANYPATENT,COPYRIGHTOROTHERINTELLECTUALPROPERTYRIGHT.
• SoftwareandworkloadsusedinperformancetestsmayhavebeenoptimizedforperformanceonlyonIntelmicroprocessors.Performancetests,suchasSYSmarkandMobileMark,aremeasuredusingspecificcomputersystems,components,software,operationsandfunctions.Anychangetoanyofthosefactorsmaycausetheresultstovary.Youshouldconsultotherinformationandperformanceteststoassistyouinfullyevaluatingyourcontemplatedpurchases,includingtheperformanceofthatproductwhencombinedwithotherproducts.
• Copyright©2016,IntelCorporation.Allrightsreserved.Intel,Pentium,Xeon,XeonPhi,Core,VTune,Cilk,andtheIntellogoaretrademarksofIntelCorporationintheU.S.andothercountries.
OptimizationNotice
Intel’scompilersmayormaynotoptimizetothesamedegreefornon-IntelmicroprocessorsforoptimizationsthatarenotuniquetoIntelmicroprocessors.TheseoptimizationsincludeSSE2,SSE3,andSSSE3instructionsetsandotheroptimizations.Inteldoesnotguaranteetheavailability,functionality,oreffectivenessofanyoptimizationonmicroprocessorsnotmanufacturedbyIntel.Microprocessor-dependentoptimizationsinthisproductareintendedforusewithIntelmicroprocessors.CertainoptimizationsnotspecifictoIntelmicroarchitecturearereservedforIntelmicroprocessors.PleaserefertotheapplicableproductUserandReferenceGuidesformoreinformationregardingthespecificinstructionsetscoveredbythisnotice.
Noticerevision#20110804
57
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
Stayconnected
• Joinus:DevOpsCorner(DeveloperLounge– MosconeWest)• Learnmore:openjdk.java.net|wercker.com/java• Follow:@OpenJDK,@wercker#JavaOne#DevOps
58
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. |
G1/JFR/jshellatJavaOne• The G1 GCinJDK9[CON6061]– Wednesday,Oct04,1:45pm- 2:30pm
• G1GC ConceptsandPerformanceTuning[CON4577]– Wednesday,Oct04,12:45pm- 1:30pm
• JavaFlightRecorderinJDK9/Java Mission Control 6[HOL3018]– Wednesday,Oct04,1:30pm- 3:30pm
• DeepDiagnostics:APMandOracleJava Flight RecorderinOracleCloud[CON6916]– Wednesday,Oct04,2:45pm- 3:30pm
• HotSpot AOT Internalsand AOT +CDSPerformanceResults[CON7772]– Thursday,Oct05,10:45am- 11:30am
• FullSpeedAhead!(Ahead-of-TimeCompilationforJavaSE)[CON3738]– Wednesday,Oct04,2:45pm- 3:30pm
• JShell:AnInteractiveShellfortheJavaPlatform[CON3969]– Wednesday,Oct04,9:30am– 10:15am
• JShell:TheUltimateMissingTool[CON1188]– Wednesday,Oct04,10:45am– 11:30pm
• VisualJShell:JShellonSteroids[CON6166]– Wednesday,Oct04,12:45pm– 1:30pm
• ExploringJava9withREPL[CON3423]– Wednesday,Oct04,1:45pm– 2:30pm
59
Copyright©2017, Oracleand/oritsaffiliates.Allrightsreserved. | 60