20 Years of Java

160
A trip down memory lane: 20 years in Java and JVM land Marcus Lagergren @lagergren

Transcript of 20 Years of Java

Atripdownmemorylane:20yearsinJavaandJVMland

MarcusLagergren@lagergren

SafeHarborStatement

@lagergren

SafeHarborStatement

[Thisismystory,myexperiences.Officialandotherpeoples’versionsofeventsmayvary]

@lagergren

“SeniorSoftwareArchitect”

https://www.klarna.com/careers/open-positions

WhathaveIbeendoingwithmylife forthesepast20years?

Aninformativekeynote

Ahistoricalkeynote

Anostalgickeynote

Agenda• It’s2015• Javahasbeenaroundfor20years.• Longerifyoucountthe

alphas/betasofJava1.0

Orevensimpler…20yearsofJavaandruntimesfromanengineer’sperspective…

Orevensimpler…20yearsofJavaandruntimesfromanengineer’sperspective…

Orevensimpler…20yearsofJavaandruntimesfromanengineer’sperspective…

Orevensimpler…20yearsofJavaandruntimesfromanengineer’sperspective…

Orevensimpler…20yearsofJavaandruntimesfromanengineer’sperspective…

Orevensimpler…20yearsofJavaandruntimesfromanengineer’sperspective…

Takeusbackto1995!

Oops…toofar

AboygetshisCommodore64

1991-1993• Project“Green”atSunMicrosystems

1991-1993• Project“Green”atSunMicrosystems

• Aportablearchitectureforhomeelectronics

1991-1993• Project“Green”atSunMicrosystems

• Aportablearchitectureforhomeelectronics

• Remotecontrols?

1994• I’mstillatuniversity• ScrapedtogetherenoughmoneytobuildahighperformanceminitowerPC• Pentium90

• “Wow!CPUfrequenciesare,like,intheFMtheFMbandthesedays”

1994• AtthesametimeinSantaClara

1994• AtthesametimeinSantaClara• Oakhasbetterapplicationsthanprogrammingremotecontrols

1994• AtthesametimeinSantaClara• Oakhasbetterapplicationsthanprogrammingremotecontrols

• DealwithNetscapefinalizing

1994• AtthesametimeinSantaClara• Oakhasbetterapplicationsthanprogrammingremotecontrols

• DealwithNetscapefinalizing• Writeonce/runeverywhere

1994• AtthesametimeinSantaClara• Oakhasbetterapplicationsthanprogrammingremotecontrols

• DealwithNetscapefinalizing• Writeonce/runeverywhere• “Networkaware”language

1995-1996• 1995wastheyearwhereInternetsuddenlymeant“TheWorldWideWeb”• 1996:JDK1.02• ThefirstJDKreleasedbySun

• JavainNetscapeNavigator

1996IworkedwithAlphasofJDK1.0atEricssonMedialab

1996IworkedwithAlphasofJDK1.0atEricssonMedialab

1996IworkedwithAlphasofJDK1.0atEricssonMedialab

TheJDKfitononeofthese[Sneakernet,backandforthtoKTHwheretherewasbandwidthandnotjustmy

v42’’modem]

1996Anyoneremembergamelan.com?

1996• InternshipatEricssonMedialab

1996• InternshipatEricssonMedialab• “PlaywithEricsson’sfuture”• Use“cuttingedgetechnology”todosomethingwithmediaondemand

1996• InternshipatEricssonMedialab• “PlaywithEricsson’sfuture”• Use“cuttingedgetechnology”todosomethingwithmediaondemand

1996• BasicallySpotify

1996• BasicallySpotify• …andNetflix

1996• BasicallySpotify• …andNetflix• …inanApplet

1996• BasicallySpotify• …andNetflix• …inanApplet• …withmpeghardwarecards

1996• Java1.0

1996• Java1.0• Purebytecodeinterpretation

• Universityprofessorsuddenlyproudofhisinterpretedtoylanguage,notashamedaspreviously

• “IfJavagetsawaywithit,Ican”• Butdidit?

1996• Java1.0• Purebytecodeinterpretation

• Universityprofessorsuddenlyproudofhisinterpretedtoylanguage,notashamedaspreviously

• “IfJavagetsawaywithit,Ican”• Butdidit?

• JavaMemoryModel(broken)

1996• Java1.0• Purebytecodeinterpretation

• Universityprofessorsuddenlyproudofhisinterpretedtoylanguage,notashamedaspreviously

• “IfJavagetsawaywithit,Ican”• Butdidit?

• JavaMemoryModel(broken)• Thread.stopandallitsfriends(@deprecated)

1996• Java1.0• Purebytecodeinterpretation

• Universityprofessorsuddenlyproudofhisinterpretedtoylanguage,notashamedaspreviously

• “IfJavagetsawaywithit,Ican”• Butdidit?

• JavaMemoryModel(broken)• Thread.stopandallitsfriends(@deprecated)• “Very1.0”

1996• “YourdevelopmentcycleismuchfasterbecauseJavais

interpreted.Thecompile-link-load-test-crash-debug-cycleisobsolete”

- JamesGosling

1996• “YourdevelopmentcycleismuchfasterbecauseJavais

interpreted.Thecompile-link-load-test-crash-debug-cycleisobsolete”

- JamesGosling

Wait!Isn’tthattheargumenttheJavaScriptkiddiesusetoday?

1996• AppealSoftwareSolutionsisfoundedinStockholm- AllmembershadextensiveJavaexperience,

havingusedthelanguagefromthestart- JavaConsulting- …and…*sigh*UML/RUP

1996

1996

1996

1997• Javaontheclientsidenotreallytakingoff

1997• Javaontheclientsidenotreallytakingoff• Writeonce/runeverywheredoes,however• Andnobufferoverruns• Andnopointers• Andautomaticmemorymanagement• ==fastapplicationdevelopment• TheJDKisagreatlibraryfordevelopment

1997• Javaontheclientsidenotreallytakingoff• Writeonce/runeverywheredoes,however• Andnobufferoverruns• Andnopointers• Andautomaticmemorymanagement• ==fastapplicationdevelopment• TheJDKisagreatlibraryfordevelopment

• Thedawnofapplicationservers

1997• Javaontheclientsidenotreallytakingoff• Writeonce/runeverywheredoes,however• Andnobufferoverruns• Andnopointers• Andautomaticmemorymanagement• ==fastapplicationdevelopment• TheJDKisagreatlibraryfordevelopment

• Thedawnofapplicationservers• PrehistorictrailtowardJavaEE

1997• Java1.1• Innerclasses• JavaBeans• JDBC• RMI• LimitedReflection(nonruntime)• ThefirstJITs• (SymanteconWindows)

• SERIALIZATION– THEHORROR!

1997:BTH– WinatriptoJavaOne

JavaOne1997• SunMicrosystemspresentstheHotSpotvirtualmachine– “WOW!Thisisthewaytodoit!Adaptiveruntimes!”

1998• JDK1.2• Swing• strictfp• JITintroducedintheclassicVM• CollectionsAPI• JDKtriplesinsize:1520classes,59packages

1998• JDK1.2• Swing• strictfp• JITintroducedintheclassicVM• CollectionsAPI• JDKtriplesinsize:1520classes,59packages

JavaOne1998• SunMicrosystemspresentstheHotSpotvirtualmachineagain

JavaOne1998• SunMicrosystemspresentstheHotSpotvirtualmachineagain– “WTF!Thisisslide-by-slidetheexactsamepresentationaslastyear!?!”

–Wecan’twaitanylonger.Let’sbuildourownVM.Howhardcanitbe?

CreatingourownJVM- JRockit

Productizeanarrowerdomain?• Server-sideusageonly.Headless.–Weneedtohelptheearlyappservervendorsgetperformanceandscalability

Productizeanarrowerdomain?• Server-sideusageonly.Headless.–Weneedtohelptheearlyappservervendorsgetperformanceandscalability

• Nointerpreter– “startuptimedoesn’tmatterontheserveranyway”

1998• BEAAcquiresWebLogic• Weblogic becomesonethefirstdriversforJ2EEspecification

1998

1998• TowerJ• ExcelsiorJET• ConvertbytecodetoCcodeandrungcc• Fundementally incompatiblewitharuntimelanguage• Rakesin$$$anyway

1999• AppealSoftwareSolutionsfinanceJRockitdevelopment• HuntingforVC• InAugustwesellthefirstpartofoursouls• Wespendnightsreadingacademicpapers• Jalapeño(tobecomeJikes RVM)

2000• Javaisnowthefastestgrowingprogramminglanguageintheworld• Dotcombubble• NASDAQhits5.000justbeforethetechwreck

2000• TheJavaLicense• Youcan’tcallyourself“Java”withoutaJavalicense

• YouneedtopasstheTCKtestsuite– Notavailablewithoutlicense

• TogetaJavaLicenseyouneeda“valueadd”

TheJavaLicense• What’sa“valueadd”?

TheJavaLicense• What’sa“valueadd”?

TheJavaLicense

TheJavaLicense• What’sa“valueadd”?

TheJavaLicense• What’sa“valueadd”?– Superiorperformance!

TheJavaLicense• What’sa“valueadd”?– Superiorperformance!–What?Youdidn’tlikethat?

TheJavaLicense• What’sa“valueadd”?– Superiorperformance!–What?Youdidn’tlikethat?– OK…Let’ssee…Err..“managability”

TheJavaLicense

2000• JDK1.3“Kestrel”– HotSpot releasedbefore,April1999J2SEJVM– ButKestrelbundlesHotSpotwithJDK– JNDI– JPDA– RMI/Corba– JavaSound

2000• Q12000– JRockit 1.0released– “Very1.0”– NxMgreenthreadshybrid–Weactuallysellsomelicenses

• Wearestupidenoughtowriteitintheyearendfinancial statement

2001

2001• AppealVirtualMachinesisbrokenoutfromAppealSoftwareSolutions

• AppealVirtualMachinesfinallygetsitsJavaLicense!

• “Managability valueadd”• Staticcompilermindsetstillverystrong• Veryhardtoselladaptiveruntimesasconcept

2001• BEAwantsperformanceandscalabilityYESTERDAY

• Wetaketimetohelpthemout• Startcooperatingonbenchmarks

2001• Intel/BEAdiscussionsaboutJRockit

2001• TheItaniumgetsintroduced

2001• JavaOne 2001• IwasmostlyinSanMateogettingJRockittorunonIA64inbinarytranslationmode

2002

2002• JDK1.4“Merlin”

– FirstplatformdevelopedunderJCP– assertkeyword– Regexps (sorta likePerlbutnotreally)– Exception.getCause()– NIO– LoggingAPI– ImageI/O– XML– IPv6

2002• Valentine’sday:BEAacquiresAppealVirtualMachines

• Now:howdowemakemoney?• Eventuallywefound4valueadds

2002• Valentine’sday:BEAacquiresAppealVirtualMachines

• Now:howdowemakemoney?• Eventuallywefound4valueadds

2002• Valueadd#1– CCE/SE– ImplementBEA’smultitiersupportprocess

2002• Valueadd#2–Managability– JSRworksstartsonJSR-174–ManagementconsoleisthefirstpartofJavaMissionControltogetoutthere

2003-2004• Somehardwareobservationsareinorder

2003-2004• Somehardwareobservationsareinorder– Clockratecurvesstarttoflattenout

2003-2004• Somehardwareobservationsareinorder– Clockratecurvesstarttoflattenout–Multicores,NUMA,hyperthreading

2003-2004• Somehardwareobservationsareinorder– Clockratecurvesstarttoflattenout–Multicores,NUMA,hyperthreading– JavastillhasexplicitThreads

2003-2004• Somehardwareobservationsareinorder– Clockratecurvesstarttoflattenout–Multicores,NUMA,hyperthreading– JavastillhasexplicitThreads– In-orderexecutionisabadideaforJITs

2003-2004• Somehardwareobservationsareinorder– Clockratecurvesstarttoflattenout–Multicores,NUMA,hyperthreading– JavastillhasexplicitThreads– In-orderexecutionisabadideaforJITs

ExecutionTime=RuntimeOverhead+ProgramRuntime

2004• JDK5.0(“Tiger”,JSR-176)

– Numberschemechangedfrom1.x– BiggestJavareleasesofar!– Generics– Annotations– Autoboxing/unboxing– Enums– Varargs (Object…)– Staticimports– java.util.concurrent

2004• TheJavaMemoryModelgetsfixed!

2004• x86_64released– nottheItanium,still64bit– ForthefirsttimeinhistoryAMDeatsIntel’slunch

– FullbackwardscompatibilitytowardsIA32– Adoption(recognizetheparalleltoJava)– Widerregisterbandwidth– 2xthenumberofregisters– EXABYTESofvirtualmemoryspace

TheBenchmarkWars

TheBenchmarkWars• SPECjvm98wasthe benchmarksincetimeimmemorial

• SPECjbb2000,2005• SPECJAppServer• RunningSPECjbb2005isaquantifiablemanagementgoal

TheBenchmarkWars• Broughtrealworldoptimizations

– Compressedreferences– Noncontiguousheapsfor32bits– Externalandinternalheapcompaction– ConcurrentGC– Biasedlocking– Largepages– NUMA– Prefetch heuristics– Usingvectorized hardwareinstructionsSSE3/4– PartialEscapeAnalysis– Offheapstorageprototypes

TheBenchmarkWars• Broughtrealworldoptimizations

– Compressedreferences– Noncontiguousheapsfor32bits– Externalandinternalheapcompaction– ConcurrentGC– Biasedlocking– Largepages– NUMA– Prefetch heuristics– Usingvectorized hardwareinstructionsSSE3/4– PartialEscapeAnalysis– Offheapstorageprototypes

TheBenchmarkWars• Allthisfromafewsemi-syntheticbenchmarks

• CompetitionleadstoJavaserversideperformancebeingpushedtowhereit’sneverbeenbefore

• “Performancereleases”notalwaysgreatforstability,though

TheBenchmarkWars“-XXaggressive”ಠ_ಠ

2004• MeanwhileatAppealVirtualMachines– Valueadd#3– DeterministicGC– QoS levelforpausetimes– Modernapplicationswantlowlatencyratherthanthroughput

– Telco,financesectorswentwild

2004java –XgcPrio:deterministic –XpauseTarget:5ms

2004java –XgcPrio:deterministic –XpauseTarget:5ms

2004• JSR-174getsfinalized• MissionControlshipswithitsfirstversions– Productiontimezerooverheadmonitoring– Limitedflightrecordings(JRA)– Extremelycheap– Justusedataavailablefromtheruntimealready

LatencyAnalysisTool

MemoryLeakDetector

2005

Halftime

2006

2006• SunMicrosystemsnotdoingalltoowell?• JavaFX isgoingon.–Mobilephonesareeverything.– Itgetsabitquietfromoursideofthescene.

2006• ApacheHarmony

– Needed torewriteclassesfromscratch– IBMandotherscontribute alotofcode

• AsksforJavalicensewhichitdoesn’tget– FieldofuserestrictionsclaimednotcompliantwithJCPrules

• VariousJCPfightsensue• SunopensupJVM/JDKsourcesunderGPLv2

2006• JDK6.0(December,JSR-270)“Mustang”– javax.scripting (builtinRhinointegration)

– CompilerAPI– JDBC4.0– Dynamiclanguages,JSR-292upforreview

Fantom

Fortress

BeanShell

Jaskell

ANTLR

JudoScript

ABCL

Erjang

X10

myForth

jdart

jgo

Nice

Gosu

Jacl

2006• Dynamic languagesarebecomingtrendy• JRuby leadsthegrowth• JSR-292,invokedynamic• BEA,IBM,Sunallintheprocess

– Wecontributesubstantiallytothespec• ThepolyglotJVMeffortisstartingtobecoordinated• Bytecode isbasically serializedJava

– Noruntime-onlydispatch

2006• Virtualization isbecomingtrendy• “TheJVMisjustaspecializedoperatingsystemforrunningJava”

• BEAStartsbuildingJRockit VirtualEdition(VE)– Valueadd#4

2006

2006• WhyisvirtualizedJavapowerful?

– Removalofabstraction– ZerocopyI/O– Moveeverythingwecantouserland– Minimizesyscalls– Threadscanprotectmemoryfromotherthreads

• CheapreadbarriersforlowlatencyGC!– Butdevicedrivers?– That’swhatwehavetheHypervisorfor– Heavilyencouragedbytheinvestmentbankingindustry

2007• ApacherequestsTCK• TheJCPstalls• JRockit needstohedgeitsbets,andcanrunHarmonyafterafewmonths

• BEA/SunJavalicensediscussions• Nolanguageupdatesfortheforseeablefuture?

2008• OracleacquiresBEA

2008• OracleacquiresBEA

2008• OracleacquiresBEA• JRockit engineeringworkscloselywithExaData andtheOracleserverstacks

• JRockit becomesdefaultOracleJVM

2008• OracleacquiresBEA• JRockit engineeringworkscloselywithExaData andtheOracleserverstacks

• JRockit becomesdefaultOracleJVM• OracleforcesthemovefromVMWare toXen forJrockit VE.

2008-2009• Politicalvacuum• Suninfinancial trouble?

2010• OracleacquiresSun!

2010• OracleacquiresSun!

2010• OracleacquiresSun!• HotRockit?• JRockit VEdies:-(

2010• Pausemusic,Marcusdoesastartup

2011• Sadly,stillnonewJavareleasesince2006• IBMjoinstheOpenJDK• Harmonyretires

2011• Sadly,stillnonewJavareleasesince2006• IBMjoinstheOpenJDK• Harmonyretires• MarcuscomesbacktotheLanguageteam

2011• Java7“Dolphin”

– Plan“A”– Initial(native)implementationofinvokedynamic bytecode– Compressedoopsdefault– ProjectCoin

• Try-with-resource,switchonstrings,binaryliterals,underscores,multicatchwith|separators

– Concurrencyutilitiesfinalized(JSR-166)– NIO-2(JSR-203)

2011• Java7extremelywellreceivedbycommunity!

• Tippingpointandcommunitygoodwill• Oracle’ssecondJavaOne extremelywellreceived

JVMArchitectureobservation• Wehavethebackwardscompatibility still• Wewillalwaysmaintainit– Insomeways,thingsmightchange,e.g.Jigsaw,butfundamentalcompatibilitywillalwaysbethere

JVMArchitectureobservation• Demo:AkroMail,binariescompiledeaster 1997.

2011-2012• Java8developmentstartspickingupspeed

• Nashorn projectofficiallystarts• JMC/servicability porttoHotSpotcompletes,partofJava8(7u40)

• Betterbuildandtestinfrastructure

2013• Crunchmode

2013• Crunchmode• Hugesecuritybackloggoesaway!

2014• Java8(releasedMarch18)– BiggestandbestJavareleaseever– Permgenremoval– Typeannotation– Unsignedintegermath– Repeatedannotations– DateandTimeAPI(JSR-310)– Nashorn

2014

2014

2014List<?> costBeforeTax =Arrays.asList(100, 200, 300, 400, 500);

for (Integer cost : costBeforeTax) { double price = cost + .25*cost; System.out.println(price);

}

2014List<?> costBeforeTax =Arrays.asList(100, 200, 300, 400, 500);

costBeforeTax.stream().map((cost) -> cost .25*cost).forEach(System.out::println);

2014List<?> costBeforeTax =Arrays.asList(100, 200, 300, 400, 500);

costBeforeTax.parallelStream().map((cost) -> cost .25*cost).forEach(System.out::println);

2014• …andthebuildprocess• ./configure; make – 5minutes– HUGEbreakthroughforproductivity

2015

2015• Java9intheworks– Jigsaw– JShell REPL(ProjectKulla)– Nashorn partialES6support,hugeperformanceimprovements

2015• AfterJava9– Valuetypes(projectValhalla)– Foreignfunctioninterface(projectPanama)– Arrays2.0– DeterministicandLowLatencyGC– MoreopensourceJVMimplementations:J9,dynamiclanguageapplications.

2015• Javaisvibrantagain!• Java8isawesome!• Java9hadanawesomeJavaOne 2015• JointheJCP!

Q&A?