SlideShare a Scribd company logo
It’s Dangerous to GC alone. Take this!
The OMR GC talk
Who are those handsome guys?
Robert Young
rwyoung@ca.ibm.com
@rwy0717
Craig Lehmann
craigl@ca.ibm.com
@CraigLehmann
2
IBM Runtime Technologies
3
4
VisualAge Smalltalk
J9 JVM
1988
?
1993
2016
5
VisualAge Smalltalk
J9 JVM
1988
OMR
1993
2016
An open source toolkit for
language runtime
technologies.
OMR
Execution Environment
7
Language-Agnostic Components
Platform Abstraction Layer
Garbage Collector
Diagnostic Services
Source Code Bytecode/AST
Compiler
Just-In-Time Compiler
InterpreterSource Bytecode
Compiler
Interpreter
Execution Environment
8
Language-Agnostic Components
Platform Abstraction Layer
Garbage Collector
Diagnostic Services
Source Code Bytecode/AST
Compiler
Just-In-Time Compiler
InterpreterSource Bytecode
Compiler
Interpreter
9
A Runtime Toolkit for Many Languages
JVM
OMR
Java App
Python
OMR
Python App
MRI
OMR
Ruby App
In Ruby
OMR
13
Getting started
14
How do we start?
http://thefeedingdoctor.com/wp-content/uploads/2013/10/Kid-Confused.jpg
15
How do we start?
16
Read the source
17
Read the source
18
19
Craig! Robert!
Tue Oct 5th - 1993
• Fantastic worldwide community
• Ruby has changed a lot over 20 years
• MRI is a complex virtual machine with a lot of history behind
it’s design decisions.
20
What we noticed
Objects
22
RVALUE
• Direct object pointers
• Conservative GC
Conservative
collection
23
Dynamic memory
string arrayhash data …
Managed Memory
• Fixed sized objects
• What about variable sized objects
Dynamic memory
string arrayhash data …
Managed Memory
malloc malloc malloc malloc
Malloc Memory
24
Dynamic memory
string arrayhash data …
malloc malloc malloc malloc
25
• No heap fragmentation
• Easy conservative marking
Dynamic memory
string arrayhash data …
malloc malloc malloc malloc
26
• Heavyweight allocation
• Malloc fragmentation
• Poor cache locality
• Expensive sweeping
Ruby has an incremental GC
Mark Sweep
Ruby
27
• GC work is interleaved with execution
• Minimizes mutator pause times
• Single threaded
• Serialized with the mutator
What we did
Goals
 Make allocations faster
 Improve GC Time
 Improve mutator performance
 100% compatibility
29
100% compatibility
 No C-extensions API changes
 Pass all extended tests
 Run Rails - unmodified
30
Let’s make it work
31
32
Starting out with Mark Sweep
static int
gc_start(rb_objspace_t *objspace …)
{
…
OMR_GC_SystemCollect();
...
}
static int
newobj_of(rb_objspace_t *objspace …)
{
...
obj = rb_omr_get_freeobj(th, sizeof(RVALUE));
...
}
33
Starting out with Mark Sweep
Need to support conservative collection
Conservative collection
Object Map (bit map)
• Object map allows us to support
conservative collection
• Bit Map used to keep track of objects
• Results in ~ 1.6% memory overhead
Let’s make it parallel
34
Multithreaded GC (Stop the world)
35
mark sweep
• Introducing Parallel Global GC
• Aggressively parallelized
• New APIs for parallelism
• Support for thread pooling and task
synchronization
Marking in parallel
36
mark sweep
Marking:
• Scan roots in parallel
• Break VM roots into subsets
• Complete marking in parallel
Sweeping in parallel
37
mark sweep
Sweeping:
• Free malloc space in parallel
• Clean up objects in parallel
• Move work out of finalization
Hey… It works!
38
New tools!
39
Garbage Collection Memory Visualizer for Ruby MRI
with zero changes to the tool
40
Health Center for Ruby MRI: Live GC visualization –
No code changes required
41
Health Center for Ruby MRI: Method profiling
42
How can we make CRuby faster?
43
Allocations!
44
Making allocation fast
Thread-local heaps:
• Cache regions of the heap per-thread
• Allocate without locking
• Better locality
45
Thread local heap
Object
TLH
Heap
Next Alloc
47
TLH
Thread local heap
TLH
Object
TLH
Heap
Next Alloc
48
Thread local heap
TLH
Object
TLH
Heap
Next Alloc
49
How can we make it faster?
50
Lets look at off heap memory!
51
How do we replace malloc/free?
• malloc/free callouts are expensive
• Rely on system for memory management concerns
• Still susceptible to fragmentation and concurrency
• Black box implementation
• Replace malloc and free with a new allocator
52
New built-in type!
55
New built-in type OMRBuffers
• Create a new, variable sized object type
• Allocate all buffers on the heap as objects
typedef struct OMRBuffer {
VALUE flags;
long size;
} OMRBuffer;
56
buffer
58
OMRBuffers on the heap!
string arrayhash data …
Managed Memory
buffer buffer buffer buffer
Malloc Memory
59
Shorter sweeping with OMRBuffers
mark sweep
GC Before
GC After
mark
sweep
Getting user defined types on heap
• RDatas are used to create C-extension types.
• Typed RDatas have a new flag:
RDATA_HEAP_ALLOCATED
• Automatically heap allocates the data buffer at allocation
• No free method results in no object finalization
• Allows for heap allocation in extensions
• Extremely easy to use
60
OMRBuffer wins
Improvements:
• Eliminated obj_free()
• Fast allocations
• Better cache locality
Challenges:
• Heap fragmentation
• Conservative collection
• Concurrency
61
Multithreaded allocations
• MRI does some work in backgrounded threads
• Use OMRBuffers in background threads
• Introduce finer grained locking than the GVL
• Allows for:
• multithreaded allocations
• GCing from a background thread
62
Is Ruby Fast Yet?
63
8% better throughput
122.57
112.84
0
20
40
60
80
100
120
140
2.2-omr 2.2.3
Experiments
64
Generational GC in MRI
• Experimenting with non-copying generational GC
• Marking is already fast
• Heap fragmentations issues
• High memory overhead
65
Segregated heap in MRI
• Introduced a segregated heap into ruby
• Heap divided into regions of fixed sized objects
• Bounds maximum heap fragmentation
66
67
Concurrent GC in MRI
• Adding Concurrent GC to Ruby
• Ruby threads incrementally mark
• Background thread scans
• Parallelized sweep (STW)
sweepmark
What’s next
70
OMR GC in Ruby – what’s next
• Ongoing experimentation
• Balanced
• Semispace copying generational collection
• compaction
• Real time garbage collection
71
What’s next for OMR?
• Open source OMR
• Make our Ruby experiments available
• We want to hear from the experts (you)
• Lets make OMR and Ruby the best they can be
72
Ruby+OMR
Tech Preview
Download @
goo.gl/P3yXuy
• Releasing a
preview so you
can start test-
driving
• Send us
feedback!
73
74
75
We want to help
Thank You!
76
John Duimovich
CTO IBM Runtimes
duimovic@ca.ibm.com
@jduimovich
Ask us Anything!
Mark Stoodley
OMR Project Lead
mstoodle@ca.ibm.com
@mstoodle
Robert Young
OMR Developer
rwyoung@ca.ibm.com
@rwy0717
77
Charlie Gracie
OMR GC Architect
crgracie@ca.ibm.com
@crgracie
Craig Lehmann
OMR Developer
craigl@ca.ibm.com
@craiglehmann
The end!
Who were those handsome guys again?
Robert Young
rwyoung@ca.ibm.com
@rwy0717
Craig Lehmann
craigl@ca.ibm.com
@CraigLehmann
82
Trademarks, Copyrights, Disclaimers
88
IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without
notice at IBM’s sole discretion. Information regarding potential future products is intended to outline our
general product direction and it should not be relied on in making a purchasing decision. The information
mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver
any material, code or functionality. Information about potential future products may not be incorporated into
any contract. The development, release, and timing of any future features or functionality described for our
products remains at our sole discretion.
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp.,
registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other
companies. A current list of other IBM trademarks is available on the web at "Copyright and trademark information" at
http://www.ibm.com/legal/copytrade.shtml
Other company, product, or service names may be trademarks or service marks of others.
THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.
WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION
CONTAINED IN THIS PRESENTATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED. IN ADDITION, THIS INFORMATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY,
WHICH ARE SUBJECT TO CHANGE BY IBM WITHOUT NOTICE. IBM SHALL NOT BE RESPONSIBLE FOR ANY
DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER
DOCUMENTATION. NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, NOR SHALL HAVE THE
EFFECT OF, CREATING ANY WARRANTIES OR REPRESENTATIONS FROM IBM (OR ITS SUPPLIERS OR
LICENSORS), OR ALTERING THE TERMS AND CONDITIONS OF ANY AGREEMENT OR LICENSE GOVERNING THE
USE OF IBM PRODUCTS OR SOFTWARE.
© Copyright International Business Machines Corporation 2015. All rights reserved.
Additional Important Disclaimers
• THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL
PURPOSES ONLY.
• WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE
INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR IMPLIED.
• ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A
CONTROLLED ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE,
SOFTWARE OR INFRASTRUCTURE DIFFERENCES.
• ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE.
• IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT
PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.
• IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING
OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER
DOCUMENTATION.
• NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
• - CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS
OR THEIR SUPPLIERS AND/OR LICENSORS
89

More Related Content

What's hot

Debugging PySpark: Spark Summit East talk by Holden Karau
Debugging PySpark: Spark Summit East talk by Holden KarauDebugging PySpark: Spark Summit East talk by Holden Karau
Debugging PySpark: Spark Summit East talk by Holden Karau
Spark Summit
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the box
Claus Ibsen
 
Fighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkFighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with Embulk
Sadayuki Furuhashi
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
FuseSource.com
 
Apache Camel K - Fredericia
Apache Camel K - FredericiaApache Camel K - Fredericia
Apache Camel K - Fredericia
Claus Ibsen
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Masahiro Nagano
 
Internship final report@Treasure Data Inc.
Internship final report@Treasure Data Inc.Internship final report@Treasure Data Inc.
Internship final report@Treasure Data Inc.
Ryuichi ITO
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
Guillaume Laforge
 
Making KVS 10x Scalable
Making KVS 10x ScalableMaking KVS 10x Scalable
Making KVS 10x Scalable
Sadayuki Furuhashi
 
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2
Claus Ibsen
 
DOSUG Taking Apache Camel For A Ride
DOSUG Taking Apache Camel For A RideDOSUG Taking Apache Camel For A Ride
DOSUG Taking Apache Camel For A Ride
Matthew McCullough
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
Hiroshi SHIBATA
 
Debugging Apache Spark
Debugging Apache SparkDebugging Apache Spark
Debugging Apache Spark
Joey Echeverria
 
Rails Performance
Rails PerformanceRails Performance
Rails Performance
Wen-Tien Chang
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play framework
Felipe
 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A Ride
Bruce Snyder
 
A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9
Marcus Lagergren
 
Spark stream - Kafka
Spark stream - Kafka Spark stream - Kafka
Spark stream - Kafka
Dori Waldman
 
Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014
Sadayuki Furuhashi
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
Hiroshi SHIBATA
 

What's hot (20)

Debugging PySpark: Spark Summit East talk by Holden Karau
Debugging PySpark: Spark Summit East talk by Holden KarauDebugging PySpark: Spark Summit East talk by Holden Karau
Debugging PySpark: Spark Summit East talk by Holden Karau
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the box
 
Fighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkFighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with Embulk
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
Apache Camel K - Fredericia
Apache Camel K - FredericiaApache Camel K - Fredericia
Apache Camel K - Fredericia
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
Internship final report@Treasure Data Inc.
Internship final report@Treasure Data Inc.Internship final report@Treasure Data Inc.
Internship final report@Treasure Data Inc.
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
 
Making KVS 10x Scalable
Making KVS 10x ScalableMaking KVS 10x Scalable
Making KVS 10x Scalable
 
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2
 
DOSUG Taking Apache Camel For A Ride
DOSUG Taking Apache Camel For A RideDOSUG Taking Apache Camel For A Ride
DOSUG Taking Apache Camel For A Ride
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
Debugging Apache Spark
Debugging Apache SparkDebugging Apache Spark
Debugging Apache Spark
 
Rails Performance
Rails PerformanceRails Performance
Rails Performance
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play framework
 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A Ride
 
A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9
 
Spark stream - Kafka
Spark stream - Kafka Spark stream - Kafka
Spark stream - Kafka
 
Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 

Viewers also liked

GC in Ruby. RubyC, Kiev, 2014.
GC in Ruby. RubyC, Kiev, 2014.GC in Ruby. RubyC, Kiev, 2014.
GC in Ruby. RubyC, Kiev, 2014.
Timothy Tsvetkov
 
Ruby Under The Hood
Ruby Under The HoodRuby Under The Hood
Ruby Under The Hood
craig lehmann
 
Eclipse OMR: a modern toolkit for building language runtimes
Eclipse OMR: a modern toolkit for building language runtimesEclipse OMR: a modern toolkit for building language runtimes
Eclipse OMR: a modern toolkit for building language runtimes
Mark Stoodley
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
Fernando Hamasaki de Amorim
 
Introduction to Meteor & React
Introduction to Meteor & ReactIntroduction to Meteor & React
Introduction to Meteor & React
Max Li
 
FizzBuzzではじめるテスト
FizzBuzzではじめるテストFizzBuzzではじめるテスト
FizzBuzzではじめるテスト
Masashi Shinbara
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
Hiroshi SHIBATA
 
Logging for Production Systems in The Container Era
Logging for Production Systems in The Container EraLogging for Production Systems in The Container Era
Logging for Production Systems in The Container Era
Sadayuki Furuhashi
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
Sadayuki Furuhashi
 
Docker環境でetherium開発環境を作る際のはまりどころ
Docker環境でetherium開発環境を作る際のはまりどころDocker環境でetherium開発環境を作る際のはまりどころ
Docker環境でetherium開発環境を作る際のはまりどころ
健一 茂木
 
Hyperledgerのチュートリアルで理解する基幹システム向けブロックチェーンハンズオン
Hyperledgerのチュートリアルで理解する基幹システム向けブロックチェーンハンズオンHyperledgerのチュートリアルで理解する基幹システム向けブロックチェーンハンズオン
Hyperledgerのチュートリアルで理解する基幹システム向けブロックチェーンハンズオン
健一 茂木
 
"fireap" - fast task runner on consul
"fireap" - fast task runner on consul"fireap" - fast task runner on consul
"fireap" - fast task runner on consul
IKEDA Kiyoshi
 
grifork - fast propagative task runner -
grifork - fast propagative task runner -grifork - fast propagative task runner -
grifork - fast propagative task runner -
IKEDA Kiyoshi
 
DigdagはなぜYAMLなのか?
DigdagはなぜYAMLなのか?DigdagはなぜYAMLなのか?
DigdagはなぜYAMLなのか?
Sadayuki Furuhashi
 
Introduction to poloxy - proxy for alerting
Introduction to poloxy - proxy for alertingIntroduction to poloxy - proxy for alerting
Introduction to poloxy - proxy for alerting
IKEDA Kiyoshi
 
TRICK2015 results
TRICK2015 resultsTRICK2015 results
TRICK2015 results
mametter
 
Sails.jsのメリット・デメリット
Sails.jsのメリット・デメリットSails.jsのメリット・デメリット
Sails.jsのメリット・デメリット
Ito Kohta
 

Viewers also liked (17)

GC in Ruby. RubyC, Kiev, 2014.
GC in Ruby. RubyC, Kiev, 2014.GC in Ruby. RubyC, Kiev, 2014.
GC in Ruby. RubyC, Kiev, 2014.
 
Ruby Under The Hood
Ruby Under The HoodRuby Under The Hood
Ruby Under The Hood
 
Eclipse OMR: a modern toolkit for building language runtimes
Eclipse OMR: a modern toolkit for building language runtimesEclipse OMR: a modern toolkit for building language runtimes
Eclipse OMR: a modern toolkit for building language runtimes
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
 
Introduction to Meteor & React
Introduction to Meteor & ReactIntroduction to Meteor & React
Introduction to Meteor & React
 
FizzBuzzではじめるテスト
FizzBuzzではじめるテストFizzBuzzではじめるテスト
FizzBuzzではじめるテスト
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
 
Logging for Production Systems in The Container Era
Logging for Production Systems in The Container EraLogging for Production Systems in The Container Era
Logging for Production Systems in The Container Era
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
 
Docker環境でetherium開発環境を作る際のはまりどころ
Docker環境でetherium開発環境を作る際のはまりどころDocker環境でetherium開発環境を作る際のはまりどころ
Docker環境でetherium開発環境を作る際のはまりどころ
 
Hyperledgerのチュートリアルで理解する基幹システム向けブロックチェーンハンズオン
Hyperledgerのチュートリアルで理解する基幹システム向けブロックチェーンハンズオンHyperledgerのチュートリアルで理解する基幹システム向けブロックチェーンハンズオン
Hyperledgerのチュートリアルで理解する基幹システム向けブロックチェーンハンズオン
 
"fireap" - fast task runner on consul
"fireap" - fast task runner on consul"fireap" - fast task runner on consul
"fireap" - fast task runner on consul
 
grifork - fast propagative task runner -
grifork - fast propagative task runner -grifork - fast propagative task runner -
grifork - fast propagative task runner -
 
DigdagはなぜYAMLなのか?
DigdagはなぜYAMLなのか?DigdagはなぜYAMLなのか?
DigdagはなぜYAMLなのか?
 
Introduction to poloxy - proxy for alerting
Introduction to poloxy - proxy for alertingIntroduction to poloxy - proxy for alerting
Introduction to poloxy - proxy for alerting
 
TRICK2015 results
TRICK2015 resultsTRICK2015 results
TRICK2015 results
 
Sails.jsのメリット・デメリット
Sails.jsのメリット・デメリットSails.jsのメリット・デメリット
Sails.jsのメリット・デメリット
 

Similar to The OMR GC talk - Ruby Kaigi 2015

FOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMRFOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMR
Charlie Gracie
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Charlie Gracie
 
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
0xdaryl
 
VMM2016-Eclipse OMR JITBuilder for better performance
VMM2016-Eclipse OMR JITBuilder for better performanceVMM2016-Eclipse OMR JITBuilder for better performance
VMM2016-Eclipse OMR JITBuilder for better performance
Charlie Gracie
 
Java one2016
Java one2016Java one2016
Java one2016
Toby Corbin
 
Ingesting Data at Blazing Speed Using Apache Orc
Ingesting Data at Blazing Speed Using Apache OrcIngesting Data at Blazing Speed Using Apache Orc
Ingesting Data at Blazing Speed Using Apache Orc
DataWorks Summit
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
Mark Stoodley
 
Turbo2018 workshop JIT as a Service
Turbo2018 workshop   JIT as a ServiceTurbo2018 workshop   JIT as a Service
Turbo2018 workshop JIT as a Service
Mark Stoodley
 
Open j9 jdk on RISC-V
Open j9 jdk on RISC-VOpen j9 jdk on RISC-V
Open j9 jdk on RISC-V
RISC-V International
 
Enabling a hardware accelerated deep learning data science experience for Apa...
Enabling a hardware accelerated deep learning data science experience for Apa...Enabling a hardware accelerated deep learning data science experience for Apa...
Enabling a hardware accelerated deep learning data science experience for Apa...
DataWorks Summit
 
Accelerating Machine Learning Applications on Spark Using GPUs
Accelerating Machine Learning Applications on Spark Using GPUsAccelerating Machine Learning Applications on Spark Using GPUs
Accelerating Machine Learning Applications on Spark Using GPUs
IBM
 
FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VM
Charlie Gracie
 
Getting to the Next Level with Eclipse Concierge - Jan Rellermeyer + Tim Verb...
Getting to the Next Level with Eclipse Concierge - Jan Rellermeyer + Tim Verb...Getting to the Next Level with Eclipse Concierge - Jan Rellermeyer + Tim Verb...
Getting to the Next Level with Eclipse Concierge - Jan Rellermeyer + Tim Verb...
mfrancis
 
Death to Manual Deployments
Death to Manual DeploymentsDeath to Manual Deployments
Death to Manual Deployments
IBM UrbanCode Products
 
Java and the GPU - Everything You Need To Know
Java and the GPU - Everything You Need To KnowJava and the GPU - Everything You Need To Know
Java and the GPU - Everything You Need To Know
Adam Roberts
 
Service Testing & Virtualization in an Enterprise Environments
Service Testing & Virtualization in an Enterprise EnvironmentsService Testing & Virtualization in an Enterprise Environments
Service Testing & Virtualization in an Enterprise Environments
DevOps for Enterprise Systems
 
Enabling a hardware accelerated deep learning data science experience for Apa...
Enabling a hardware accelerated deep learning data science experience for Apa...Enabling a hardware accelerated deep learning data science experience for Apa...
Enabling a hardware accelerated deep learning data science experience for Apa...
Indrajit Poddar
 
Academic Discussion Group Workshop 2018 November 10 st 2018 Nimbix CAPI SNAP...
Academic Discussion  Group Workshop 2018 November 10 st 2018 Nimbix CAPI SNAP...Academic Discussion  Group Workshop 2018 November 10 st 2018 Nimbix CAPI SNAP...
Academic Discussion Group Workshop 2018 November 10 st 2018 Nimbix CAPI SNAP...
Ganesan Narayanasamy
 
WebSphere Technical University: Introduction to the Java Diagnostic Tools
WebSphere Technical University: Introduction to the Java Diagnostic ToolsWebSphere Technical University: Introduction to the Java Diagnostic Tools
WebSphere Technical University: Introduction to the Java Diagnostic Tools
Chris Bailey
 
Real-Time Voice Actuation
Real-Time Voice ActuationReal-Time Voice Actuation
Real-Time Voice Actuation
Pragya Agrawal
 

Similar to The OMR GC talk - Ruby Kaigi 2015 (20)

FOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMRFOSDEM2016 - Ruby and OMR
FOSDEM2016 - Ruby and OMR
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
 
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
JavaOne 2015 CON7547 "Beyond the Coffee Cup: Leveraging Java Runtime Technolo...
 
VMM2016-Eclipse OMR JITBuilder for better performance
VMM2016-Eclipse OMR JITBuilder for better performanceVMM2016-Eclipse OMR JITBuilder for better performance
VMM2016-Eclipse OMR JITBuilder for better performance
 
Java one2016
Java one2016Java one2016
Java one2016
 
Ingesting Data at Blazing Speed Using Apache Orc
Ingesting Data at Blazing Speed Using Apache OrcIngesting Data at Blazing Speed Using Apache Orc
Ingesting Data at Blazing Speed Using Apache Orc
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
Turbo2018 workshop JIT as a Service
Turbo2018 workshop   JIT as a ServiceTurbo2018 workshop   JIT as a Service
Turbo2018 workshop JIT as a Service
 
Open j9 jdk on RISC-V
Open j9 jdk on RISC-VOpen j9 jdk on RISC-V
Open j9 jdk on RISC-V
 
Enabling a hardware accelerated deep learning data science experience for Apa...
Enabling a hardware accelerated deep learning data science experience for Apa...Enabling a hardware accelerated deep learning data science experience for Apa...
Enabling a hardware accelerated deep learning data science experience for Apa...
 
Accelerating Machine Learning Applications on Spark Using GPUs
Accelerating Machine Learning Applications on Spark Using GPUsAccelerating Machine Learning Applications on Spark Using GPUs
Accelerating Machine Learning Applications on Spark Using GPUs
 
FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VM
 
Getting to the Next Level with Eclipse Concierge - Jan Rellermeyer + Tim Verb...
Getting to the Next Level with Eclipse Concierge - Jan Rellermeyer + Tim Verb...Getting to the Next Level with Eclipse Concierge - Jan Rellermeyer + Tim Verb...
Getting to the Next Level with Eclipse Concierge - Jan Rellermeyer + Tim Verb...
 
Death to Manual Deployments
Death to Manual DeploymentsDeath to Manual Deployments
Death to Manual Deployments
 
Java and the GPU - Everything You Need To Know
Java and the GPU - Everything You Need To KnowJava and the GPU - Everything You Need To Know
Java and the GPU - Everything You Need To Know
 
Service Testing & Virtualization in an Enterprise Environments
Service Testing & Virtualization in an Enterprise EnvironmentsService Testing & Virtualization in an Enterprise Environments
Service Testing & Virtualization in an Enterprise Environments
 
Enabling a hardware accelerated deep learning data science experience for Apa...
Enabling a hardware accelerated deep learning data science experience for Apa...Enabling a hardware accelerated deep learning data science experience for Apa...
Enabling a hardware accelerated deep learning data science experience for Apa...
 
Academic Discussion Group Workshop 2018 November 10 st 2018 Nimbix CAPI SNAP...
Academic Discussion  Group Workshop 2018 November 10 st 2018 Nimbix CAPI SNAP...Academic Discussion  Group Workshop 2018 November 10 st 2018 Nimbix CAPI SNAP...
Academic Discussion Group Workshop 2018 November 10 st 2018 Nimbix CAPI SNAP...
 
WebSphere Technical University: Introduction to the Java Diagnostic Tools
WebSphere Technical University: Introduction to the Java Diagnostic ToolsWebSphere Technical University: Introduction to the Java Diagnostic Tools
WebSphere Technical University: Introduction to the Java Diagnostic Tools
 
Real-Time Voice Actuation
Real-Time Voice ActuationReal-Time Voice Actuation
Real-Time Voice Actuation
 

Recently uploaded

Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
TaghreedAltamimi
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
john krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptxjohn krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptx
Madan Karki
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 

Recently uploaded (20)

Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
john krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptxjohn krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptx
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 

The OMR GC talk - Ruby Kaigi 2015

  • 1. It’s Dangerous to GC alone. Take this! The OMR GC talk
  • 2. Who are those handsome guys? Robert Young rwyoung@ca.ibm.com @rwy0717 Craig Lehmann craigl@ca.ibm.com @CraigLehmann 2
  • 6. An open source toolkit for language runtime technologies. OMR
  • 7. Execution Environment 7 Language-Agnostic Components Platform Abstraction Layer Garbage Collector Diagnostic Services Source Code Bytecode/AST Compiler Just-In-Time Compiler InterpreterSource Bytecode Compiler Interpreter
  • 8. Execution Environment 8 Language-Agnostic Components Platform Abstraction Layer Garbage Collector Diagnostic Services Source Code Bytecode/AST Compiler Just-In-Time Compiler InterpreterSource Bytecode Compiler Interpreter
  • 9. 9 A Runtime Toolkit for Many Languages JVM OMR Java App Python OMR Python App MRI OMR Ruby App
  • 12. 14 How do we start? http://thefeedingdoctor.com/wp-content/uploads/2013/10/Kid-Confused.jpg
  • 13. 15 How do we start?
  • 14. 16
  • 18. • Fantastic worldwide community • Ruby has changed a lot over 20 years • MRI is a complex virtual machine with a lot of history behind it’s design decisions. 20
  • 20. Objects 22 RVALUE • Direct object pointers • Conservative GC Conservative collection
  • 21. 23 Dynamic memory string arrayhash data … Managed Memory • Fixed sized objects • What about variable sized objects
  • 22. Dynamic memory string arrayhash data … Managed Memory malloc malloc malloc malloc Malloc Memory 24
  • 23. Dynamic memory string arrayhash data … malloc malloc malloc malloc 25 • No heap fragmentation • Easy conservative marking
  • 24. Dynamic memory string arrayhash data … malloc malloc malloc malloc 26 • Heavyweight allocation • Malloc fragmentation • Poor cache locality • Expensive sweeping
  • 25. Ruby has an incremental GC Mark Sweep Ruby 27 • GC work is interleaved with execution • Minimizes mutator pause times • Single threaded • Serialized with the mutator
  • 27. Goals  Make allocations faster  Improve GC Time  Improve mutator performance  100% compatibility 29
  • 28. 100% compatibility  No C-extensions API changes  Pass all extended tests  Run Rails - unmodified 30
  • 29. Let’s make it work 31
  • 30. 32 Starting out with Mark Sweep static int gc_start(rb_objspace_t *objspace …) { … OMR_GC_SystemCollect(); ... } static int newobj_of(rb_objspace_t *objspace …) { ... obj = rb_omr_get_freeobj(th, sizeof(RVALUE)); ... }
  • 31. 33 Starting out with Mark Sweep Need to support conservative collection Conservative collection Object Map (bit map) • Object map allows us to support conservative collection • Bit Map used to keep track of objects • Results in ~ 1.6% memory overhead
  • 32. Let’s make it parallel 34
  • 33. Multithreaded GC (Stop the world) 35 mark sweep • Introducing Parallel Global GC • Aggressively parallelized • New APIs for parallelism • Support for thread pooling and task synchronization
  • 34. Marking in parallel 36 mark sweep Marking: • Scan roots in parallel • Break VM roots into subsets • Complete marking in parallel
  • 35. Sweeping in parallel 37 mark sweep Sweeping: • Free malloc space in parallel • Clean up objects in parallel • Move work out of finalization
  • 38. Garbage Collection Memory Visualizer for Ruby MRI with zero changes to the tool 40
  • 39. Health Center for Ruby MRI: Live GC visualization – No code changes required 41
  • 40. Health Center for Ruby MRI: Method profiling 42
  • 41. How can we make CRuby faster? 43
  • 43. Making allocation fast Thread-local heaps: • Cache regions of the heap per-thread • Allocate without locking • Better locality 45
  • 47. How can we make it faster? 50
  • 48. Lets look at off heap memory! 51
  • 49. How do we replace malloc/free? • malloc/free callouts are expensive • Rely on system for memory management concerns • Still susceptible to fragmentation and concurrency • Black box implementation • Replace malloc and free with a new allocator 52
  • 51. New built-in type OMRBuffers • Create a new, variable sized object type • Allocate all buffers on the heap as objects typedef struct OMRBuffer { VALUE flags; long size; } OMRBuffer; 56 buffer
  • 52. 58 OMRBuffers on the heap! string arrayhash data … Managed Memory buffer buffer buffer buffer Malloc Memory
  • 53. 59 Shorter sweeping with OMRBuffers mark sweep GC Before GC After mark sweep
  • 54. Getting user defined types on heap • RDatas are used to create C-extension types. • Typed RDatas have a new flag: RDATA_HEAP_ALLOCATED • Automatically heap allocates the data buffer at allocation • No free method results in no object finalization • Allows for heap allocation in extensions • Extremely easy to use 60
  • 55. OMRBuffer wins Improvements: • Eliminated obj_free() • Fast allocations • Better cache locality Challenges: • Heap fragmentation • Conservative collection • Concurrency 61
  • 56. Multithreaded allocations • MRI does some work in backgrounded threads • Use OMRBuffers in background threads • Introduce finer grained locking than the GVL • Allows for: • multithreaded allocations • GCing from a background thread 62
  • 57. Is Ruby Fast Yet? 63 8% better throughput 122.57 112.84 0 20 40 60 80 100 120 140 2.2-omr 2.2.3
  • 59. Generational GC in MRI • Experimenting with non-copying generational GC • Marking is already fast • Heap fragmentations issues • High memory overhead 65
  • 60. Segregated heap in MRI • Introduced a segregated heap into ruby • Heap divided into regions of fixed sized objects • Bounds maximum heap fragmentation 66
  • 61. 67 Concurrent GC in MRI • Adding Concurrent GC to Ruby • Ruby threads incrementally mark • Background thread scans • Parallelized sweep (STW) sweepmark
  • 63. OMR GC in Ruby – what’s next • Ongoing experimentation • Balanced • Semispace copying generational collection • compaction • Real time garbage collection 71
  • 64. What’s next for OMR? • Open source OMR • Make our Ruby experiments available • We want to hear from the experts (you) • Lets make OMR and Ruby the best they can be 72
  • 65. Ruby+OMR Tech Preview Download @ goo.gl/P3yXuy • Releasing a preview so you can start test- driving • Send us feedback! 73
  • 66. 74
  • 69. John Duimovich CTO IBM Runtimes duimovic@ca.ibm.com @jduimovich Ask us Anything! Mark Stoodley OMR Project Lead mstoodle@ca.ibm.com @mstoodle Robert Young OMR Developer rwyoung@ca.ibm.com @rwy0717 77 Charlie Gracie OMR GC Architect crgracie@ca.ibm.com @crgracie Craig Lehmann OMR Developer craigl@ca.ibm.com @craiglehmann
  • 71. Who were those handsome guys again? Robert Young rwyoung@ca.ibm.com @rwy0717 Craig Lehmann craigl@ca.ibm.com @CraigLehmann 82
  • 72. Trademarks, Copyrights, Disclaimers 88 IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM’s sole discretion. Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or functionality. Information about potential future products may not be incorporated into any contract. The development, release, and timing of any future features or functionality described for our products remains at our sole discretion. IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of other IBM trademarks is available on the web at "Copyright and trademark information" at http://www.ibm.com/legal/copytrade.shtml Other company, product, or service names may be trademarks or service marks of others. THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN ADDITION, THIS INFORMATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM WITHOUT NOTICE. IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, NOR SHALL HAVE THE EFFECT OF, CREATING ANY WARRANTIES OR REPRESENTATIONS FROM IBM (OR ITS SUPPLIERS OR LICENSORS), OR ALTERING THE TERMS AND CONDITIONS OF ANY AGREEMENT OR LICENSE GOVERNING THE USE OF IBM PRODUCTS OR SOFTWARE. © Copyright International Business Machines Corporation 2015. All rights reserved.
  • 73. Additional Important Disclaimers • THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. • WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. • ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR INFRASTRUCTURE DIFFERENCES. • ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE. • IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE. • IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. • NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF: • - CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS 89