SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

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
 

What's hot (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
 

Similar to 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
 

Similar to 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 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!
 
Garbage First & You
Garbage First & YouGarbage First & You
Garbage First & 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
 

Recently uploaded

Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 

Recently uploaded (20)

Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 

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