SlideShare une entreprise Scribd logo
1  sur  25
Intro to functional programming.
Hidetomo Morimoto
http://github.com/mocchidesu
2015/02/20
 Brief history of Java
 Lamdas / Stream API
 Why “functional” language?
 Benchmark multi-core
 Basic garbage collection
 Open JDK / HotSpot VM?
 G1GC James Gosling: Father of Java
Understand this hell
java –jar
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
-Xx:InitiatingHeapOccupancyPercent=45
-XX:NewRatio=n (young generation)
-XX:SurvivorRatio=n (eden/survivor space)
-XX:ParallelGCThreads=n
-XX:+ScavengeBeforeFullGC
-XX:G1HeapRegionSize=8M
(UseParallelGC/UseSerialGC/UseConcMarkSweepGC)
Blah Blah Blah…
Date Version Highlights
1991 Oak by James Gosling@Sun
Microsystems
Named after oak tree stood
outside his office. For small
PDA device. Slight flavor of C
1996 Jan 23 JDK 1.0 “Oak” sounds similar to “awk”?
1997 Java 1.1 JDBC, reflection, JIT compiler
1998 Java2 (J2SE) Collection framework,
Swing(GUI) API
2000 Java 1.3 JNDI, RMI
2002 Feb. Java 1.4 Regex, JAXP
2004 Sept. Java 1.5 Generics, annotation, enum,
concurrency, varargs
2006 Dec. Java 1.6 Performance tune, JDBC4
2011 July Java 1.7 JVM support dynamic language
(syntax wise, no change)
Features
DateTime API (no more new Date(), Calendar.getInstance()!)
Nashborn JavaScript engine ($JAVA_HOME/bin/jjs)
Default method in Interface / Improved concurrent package
Lambda expressions
@FunctionalInterface annotations
Method Reference
java.util.Stream package
Backward Compatibility
Binary compatibility && Behavioral compatibility - Excellent
Source compatibility - Good
Lambda is a syntax “sugar” of anonymous class
that has 1 method: Functional Interface.
(Runnable, Comparable, etc.)
@Abstract Word Clod for Concurrency
http://www.123rf.com/photo_16617606_abstract-word-cloud-for-concurrency-with-related-tags-and-terms.html
 Task Parallelism vs. Data Parallelism.
  Functional Language approach
  Same Idea: MapReduce Google BigTable
(utilize thousands of commodity machines)
Functional Language
Referential Transparency
 Return is purely determined by input (no Side
Effect)
 Always the same return
 Easier to Memonized
Function is the 1st class object
Sequence of elements from a source that
supports aggregate operations
(Out of 250M people. Pick age 20-30, Living within X miles from LA, male, etc.)
Start with .stream(), chain with intermediate
operators, end with terminal operator.
Intermediate Operator
(filter, map, sorted, distinct, limit)
Terminal Operator
(forEach, collect, reduce, iterator)
 Developer likes benchmark, hates meeting.
 Microbenchmarking framework. JMH
 Numerous reasons you don’t do it yourself.
▪ HotSpot VM compiles “hotspot”
▪ VM optimize code flow
 Annotation basis
 Open JDK
 https://github.com/mocchidesu/java8bench
Let’s Talk about
OLD Technology
 Since 1960. Not changed for 50 years.
 Only 3 basic algorithms.
 Mark & Sweep GC by John McCarthy(1960)
 Copy GC by Marvin Minsky (1963)
 Reference Counting GC by George E. Collins
(1960)
Mark Phase: Flag all the
accessible object. (from root,
register, call stack)
Sweep Phase: Remove
unreferenced.
Pros
 Simple / Easy
Cons
 Memory Fragmentation
 Stop the world (Entire heap
scan)
 Heap divided into two
equal space (To : From)
 Pros
 No Memory
Fragmentation
 Cons
 Overhead of copying.
 Requires twice the size.
Increment / Decrement
reference count each
object.
Pros
 Quick GC
Cons
 Circular Reference
Circular Reference
 Any of recent GC is the mix of those 3.
 Generational GC is an approach.
▪ Young generation
▪ Survivor space (copy gc)
▪ Old / Tenured
90%+ objects are gone immediately
Why do we need to process full GC each time?
Let’s divided them up.
If Object survived through GC process one time, promote to Survivor Space
If Object survived XX times, promote to Tenured space.
Young generation GC (Scavenge) happens more often than Tenured space.
 Garbage First Garbage Collection
 Generational
 High Throughput
 Optimized for Server / Client architecture
 Memory compaction
 Introduced Java1.7 ver…
java –jar
-XX:+UseG1GC (Generational, high throughput, suitable for server-client architecture)
-XX:MaxGCPauseMillis=200
-Xx:InitiatingHeapOccupancyPercent=45
-XX:NewRatio=n (young generation)
-XX:SurvivorRatio=n (eden/survivor space)
-XX:ParallelGCThreads=n (number of cores)
-XX:+ScavengeBeforeFullGC
(UseParallelGC/UseSerialGC/UseConcMarkSweep
GC)
 Lambda is not only a syntax sugar
 It’s a new era of Java
 When use? NOW
 GC is fun
Oracle Java Garbage Collection
http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html
Oracle Compatibility Guide for JDK 8
http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-
2156366.html
Lambda Peek under the Hood by Brian Goetz - Java One 2013
http://www.slideshare.net/jaxlondon2012/lambda-a-peek-under-the-hood-brian-
goetz
10 Example of Lambda Expressions and Streams in Java 8
http://javarevisited.blogspot.com/2014/02/10-example-of-lambda-expressions-in-
java8.html
Java8 bench gc
Java8 bench gc

Contenu connexe

Tendances

Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGSylvain Wallez
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance TuningMinh Hoang
 
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia "What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia Vladimir Ivanov
 
Java Hates Linux. Deal With It.
Java Hates Linux.  Deal With It.Java Hates Linux.  Deal With It.
Java Hates Linux. Deal With It.Greg Banks
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerKoichi Sakata
 
JVM JIT compilation overview by Vladimir Ivanov
JVM JIT compilation overview by Vladimir IvanovJVM JIT compilation overview by Vladimir Ivanov
JVM JIT compilation overview by Vladimir IvanovZeroTurnaround
 
Rtabmap investigation report-lihang
Rtabmap investigation report-lihangRtabmap investigation report-lihang
Rtabmap investigation report-lihangLihang Li
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaIsuru Perera
 
JVM JIT-compiler overview @ JavaOne Moscow 2013
JVM JIT-compiler overview @ JavaOne Moscow 2013JVM JIT-compiler overview @ JavaOne Moscow 2013
JVM JIT-compiler overview @ JavaOne Moscow 2013Vladimir Ivanov
 
An Introduction To Java Profiling
An Introduction To Java ProfilingAn Introduction To Java Profiling
An Introduction To Java Profilingschlebu
 
Rgbdslam and mapping_investigation_report-lihang
Rgbdslam and mapping_investigation_report-lihangRgbdslam and mapping_investigation_report-lihang
Rgbdslam and mapping_investigation_report-lihangLihang Li
 
Java Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoJava Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoValeriia Maliarenko
 
OpenMP Tutorial for Beginners
OpenMP Tutorial for BeginnersOpenMP Tutorial for Beginners
OpenMP Tutorial for BeginnersDhanashree Prasad
 

Tendances (20)

Java in flames
Java in flamesJava in flames
Java in flames
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
 
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia "What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
 
Java Hates Linux. Deal With It.
Java Hates Linux.  Deal With It.Java Hates Linux.  Deal With It.
Java Hates Linux. Deal With It.
 
The Java Memory Model
The Java Memory ModelThe Java Memory Model
The Java Memory Model
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT Compiler
 
JVM JIT compilation overview by Vladimir Ivanov
JVM JIT compilation overview by Vladimir IvanovJVM JIT compilation overview by Vladimir Ivanov
JVM JIT compilation overview by Vladimir Ivanov
 
Rtabmap investigation report-lihang
Rtabmap investigation report-lihangRtabmap investigation report-lihang
Rtabmap investigation report-lihang
 
Software Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in JavaSoftware Profiling: Understanding Java Performance and how to profile in Java
Software Profiling: Understanding Java Performance and how to profile in Java
 
JVM JIT-compiler overview @ JavaOne Moscow 2013
JVM JIT-compiler overview @ JavaOne Moscow 2013JVM JIT-compiler overview @ JavaOne Moscow 2013
JVM JIT-compiler overview @ JavaOne Moscow 2013
 
Parallel Programming
Parallel ProgrammingParallel Programming
Parallel Programming
 
An Introduction To Java Profiling
An Introduction To Java ProfilingAn Introduction To Java Profiling
An Introduction To Java Profiling
 
Rgbdslam and mapping_investigation_report-lihang
Rgbdslam and mapping_investigation_report-lihangRgbdslam and mapping_investigation_report-lihang
Rgbdslam and mapping_investigation_report-lihang
 
JVM++: The Graal VM
JVM++: The Graal VMJVM++: The Graal VM
JVM++: The Graal VM
 
Complete Java Course
Complete Java CourseComplete Java Course
Complete Java Course
 
OpenMP And C++
OpenMP And C++OpenMP And C++
OpenMP And C++
 
What's new in Java 11
What's new in Java 11What's new in Java 11
What's new in Java 11
 
Java Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoJava Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey Kovalenko
 
OpenMP Tutorial for Beginners
OpenMP Tutorial for BeginnersOpenMP Tutorial for Beginners
OpenMP Tutorial for Beginners
 

Similaire à Java8 bench gc

Exploring Garbage Collection
Exploring Garbage CollectionExploring Garbage Collection
Exploring Garbage CollectionESUG
 
«Большие объёмы данных и сборка мусора в Java
«Большие объёмы данных и сборка мусора в Java«Большие объёмы данных и сборка мусора в Java
«Большие объёмы данных и сборка мусора в JavaOlga Lavrentieva
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and youKai Koenig
 
Garbage First and You!
Garbage First and You!Garbage First and You!
Garbage First and You!devObjective
 
JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance TuningJeremy Leisy
 
Taming Java Garbage Collector
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage CollectorDaya Atapattu
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvmPrem Kuppumani
 
[Jbcn 2016] Garbage Collectors WTF!?
[Jbcn 2016] Garbage Collectors WTF!?[Jbcn 2016] Garbage Collectors WTF!?
[Jbcn 2016] Garbage Collectors WTF!?Alonso Torres
 
Garbage Collection in Hotspot JVM
Garbage Collection in Hotspot JVMGarbage Collection in Hotspot JVM
Garbage Collection in Hotspot JVMjaganmohanreddyk
 
The JVM is your friend
The JVM is your friendThe JVM is your friend
The JVM is your friendKai Koenig
 
A quick view about Java Virtual Machine
A quick view about Java Virtual MachineA quick view about Java Virtual Machine
A quick view about Java Virtual MachineJoão Santana
 
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
“Show Me the Garbage!”, Garbage Collection a Friend or a FoeHaim Yadid
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVMaragozin
 
Let's talk about Garbage Collection
Let's talk about Garbage CollectionLet's talk about Garbage Collection
Let's talk about Garbage CollectionHaim Yadid
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020Jelastic Multi-Cloud PaaS
 
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageChoosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageJelastic Multi-Cloud PaaS
 

Similaire à Java8 bench gc (20)

Exploring Garbage Collection
Exploring Garbage CollectionExploring Garbage Collection
Exploring Garbage Collection
 
[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe
 
«Большие объёмы данных и сборка мусора в Java
«Большие объёмы данных и сборка мусора в Java«Большие объёмы данных и сборка мусора в Java
«Большие объёмы данных и сборка мусора в Java
 
JVM Magic
JVM MagicJVM Magic
JVM Magic
 
Garbage First & You
Garbage First & YouGarbage First & You
Garbage First & You
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and you
 
Garbage First and You!
Garbage First and You!Garbage First and You!
Garbage First and You!
 
JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance Tuning
 
Taming Java Garbage Collector
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage Collector
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
[Jbcn 2016] Garbage Collectors WTF!?
[Jbcn 2016] Garbage Collectors WTF!?[Jbcn 2016] Garbage Collectors WTF!?
[Jbcn 2016] Garbage Collectors WTF!?
 
Garbage Collection in Hotspot JVM
Garbage Collection in Hotspot JVMGarbage Collection in Hotspot JVM
Garbage Collection in Hotspot JVM
 
Jvm is-your-friend
Jvm is-your-friendJvm is-your-friend
Jvm is-your-friend
 
The JVM is your friend
The JVM is your friendThe JVM is your friend
The JVM is your friend
 
A quick view about Java Virtual Machine
A quick view about Java Virtual MachineA quick view about Java Virtual Machine
A quick view about Java Virtual Machine
 
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
 
Garbage collection in JVM
Garbage collection in JVMGarbage collection in JVM
Garbage collection in JVM
 
Let's talk about Garbage Collection
Let's talk about Garbage CollectionLet's talk about Garbage Collection
Let's talk about Garbage Collection
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
 
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageChoosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
 

Dernier

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptxrouholahahmadi9876
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...vershagrag
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 

Dernier (20)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 

Java8 bench gc

  • 1. Intro to functional programming. Hidetomo Morimoto http://github.com/mocchidesu 2015/02/20
  • 2.  Brief history of Java  Lamdas / Stream API  Why “functional” language?  Benchmark multi-core  Basic garbage collection  Open JDK / HotSpot VM?  G1GC James Gosling: Father of Java
  • 3. Understand this hell java –jar -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xx:InitiatingHeapOccupancyPercent=45 -XX:NewRatio=n (young generation) -XX:SurvivorRatio=n (eden/survivor space) -XX:ParallelGCThreads=n -XX:+ScavengeBeforeFullGC -XX:G1HeapRegionSize=8M (UseParallelGC/UseSerialGC/UseConcMarkSweepGC) Blah Blah Blah…
  • 4. Date Version Highlights 1991 Oak by James Gosling@Sun Microsystems Named after oak tree stood outside his office. For small PDA device. Slight flavor of C 1996 Jan 23 JDK 1.0 “Oak” sounds similar to “awk”? 1997 Java 1.1 JDBC, reflection, JIT compiler 1998 Java2 (J2SE) Collection framework, Swing(GUI) API 2000 Java 1.3 JNDI, RMI 2002 Feb. Java 1.4 Regex, JAXP 2004 Sept. Java 1.5 Generics, annotation, enum, concurrency, varargs 2006 Dec. Java 1.6 Performance tune, JDBC4 2011 July Java 1.7 JVM support dynamic language (syntax wise, no change)
  • 5. Features DateTime API (no more new Date(), Calendar.getInstance()!) Nashborn JavaScript engine ($JAVA_HOME/bin/jjs) Default method in Interface / Improved concurrent package Lambda expressions @FunctionalInterface annotations Method Reference java.util.Stream package Backward Compatibility Binary compatibility && Behavioral compatibility - Excellent Source compatibility - Good
  • 6. Lambda is a syntax “sugar” of anonymous class that has 1 method: Functional Interface. (Runnable, Comparable, etc.)
  • 7. @Abstract Word Clod for Concurrency http://www.123rf.com/photo_16617606_abstract-word-cloud-for-concurrency-with-related-tags-and-terms.html
  • 8.  Task Parallelism vs. Data Parallelism.   Functional Language approach   Same Idea: MapReduce Google BigTable (utilize thousands of commodity machines)
  • 9. Functional Language Referential Transparency  Return is purely determined by input (no Side Effect)  Always the same return  Easier to Memonized Function is the 1st class object
  • 10. Sequence of elements from a source that supports aggregate operations (Out of 250M people. Pick age 20-30, Living within X miles from LA, male, etc.) Start with .stream(), chain with intermediate operators, end with terminal operator. Intermediate Operator (filter, map, sorted, distinct, limit) Terminal Operator (forEach, collect, reduce, iterator)
  • 11.  Developer likes benchmark, hates meeting.  Microbenchmarking framework. JMH  Numerous reasons you don’t do it yourself. ▪ HotSpot VM compiles “hotspot” ▪ VM optimize code flow  Annotation basis  Open JDK  https://github.com/mocchidesu/java8bench
  • 13.  Since 1960. Not changed for 50 years.  Only 3 basic algorithms.  Mark & Sweep GC by John McCarthy(1960)  Copy GC by Marvin Minsky (1963)  Reference Counting GC by George E. Collins (1960)
  • 14. Mark Phase: Flag all the accessible object. (from root, register, call stack) Sweep Phase: Remove unreferenced. Pros  Simple / Easy Cons  Memory Fragmentation  Stop the world (Entire heap scan)
  • 15.  Heap divided into two equal space (To : From)  Pros  No Memory Fragmentation  Cons  Overhead of copying.  Requires twice the size.
  • 16. Increment / Decrement reference count each object. Pros  Quick GC Cons  Circular Reference Circular Reference
  • 17.  Any of recent GC is the mix of those 3.  Generational GC is an approach. ▪ Young generation ▪ Survivor space (copy gc) ▪ Old / Tenured
  • 18. 90%+ objects are gone immediately Why do we need to process full GC each time?
  • 19. Let’s divided them up. If Object survived through GC process one time, promote to Survivor Space If Object survived XX times, promote to Tenured space. Young generation GC (Scavenge) happens more often than Tenured space.
  • 20.  Garbage First Garbage Collection  Generational  High Throughput  Optimized for Server / Client architecture  Memory compaction  Introduced Java1.7 ver…
  • 21. java –jar -XX:+UseG1GC (Generational, high throughput, suitable for server-client architecture) -XX:MaxGCPauseMillis=200 -Xx:InitiatingHeapOccupancyPercent=45 -XX:NewRatio=n (young generation) -XX:SurvivorRatio=n (eden/survivor space) -XX:ParallelGCThreads=n (number of cores) -XX:+ScavengeBeforeFullGC (UseParallelGC/UseSerialGC/UseConcMarkSweep GC)
  • 22.  Lambda is not only a syntax sugar  It’s a new era of Java  When use? NOW  GC is fun
  • 23. Oracle Java Garbage Collection http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html Oracle Compatibility Guide for JDK 8 http://www.oracle.com/technetwork/java/javase/8-compatibility-guide- 2156366.html Lambda Peek under the Hood by Brian Goetz - Java One 2013 http://www.slideshare.net/jaxlondon2012/lambda-a-peek-under-the-hood-brian- goetz 10 Example of Lambda Expressions and Streams in Java 8 http://javarevisited.blogspot.com/2014/02/10-example-of-lambda-expressions-in- java8.html