SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
Object graphs
swapping
m a r i a n o m a r t i n e z p e c k
m a r i a n o p e c k @ g m a i l . c o m
RMod
1
Wednesday, September 15, 2010
The context
2
Wednesday, September 15, 2010
The context
2
Wednesday, September 15, 2010
The context
2
Wednesday, September 15, 2010
The context
2
Wednesday, September 15, 2010
The context
2
Wednesday, September 15, 2010
The context
2
Wednesday, September 15, 2010
Problem
Use more memory than needed.
Make OOP languages unsuitable for memory
limited devices.
Existence of unused but referenced objects.
3
Wednesday, September 15, 2010
The context
In OOP primary memory is represented by an object graph
A B C
D E F G H
Y
K
X
I LJ
Z
4
Wednesday, September 15, 2010
Garbage Collector
Only collects objects that nobody else points to.
A B C
D E F G H
Y
K
X
I LJ
Z
5
Wednesday, September 15, 2010
Garbage Collector
Only collects objects that nobody else points to.
A B C
D E F G H
Y
K
X
I LJ
Z
5
Wednesday, September 15, 2010
Garbage Collector
Only collects objects that nobody else points to.
A B C
D E F G H
Y
K
X
I LJ
Z
5
Wednesday, September 15, 2010
Garbage Collector
Only collects objects that nobody else points to.
A B C
D E F G H
Y
K
X
I LJ
Z
5
Wednesday, September 15, 2010
6
But...what happens with referenced yet unused objects?
A B C
D E F G H
Y
K
X
I LJ
Z
Wednesday, September 15, 2010
Idea
Swap out (not remove) unused objects to
disk.
Automatically load them back when needed.
7
Wednesday, September 15, 2010
Related work
Large object oriented memory (LOOM).
Melt - Supporting memory leaks.
ImageSegments.
8
Wednesday, September 15, 2010
But...no one solves all the problems
9
Wednesday, September 15, 2010
Main challenges
Not to use more memory than the one
released by swapping.
Low overhead penalty.
Group objects in an smart way.
10
Wednesday, September 15, 2010
Key aspects
Mark and trace unused/used objects at
runtime.
The usage of proxies.
Group unused objects (subgraphs).
11
Wednesday, September 15, 2010
Why we need to
group objects?
Because if we replace each object by a proxy,
we release little memory.
We want to replace a whole group by one or a
few proxies.
12
Wednesday, September 15, 2010
Why subgraphs?
Group of objects that are used (or not used)
together.
We need few proxies (for the roots) for
several objects.
13
Wednesday, September 15, 2010
Experiments done
Modify Smalltalk VM to mark and trace
objects usage.
Visualize objects and memory usage.
Take statistics from different scenarios.
14
Wednesday, September 15, 2010
deployed web
application example
4%
96%
Amount of objects
Used Unused
15%
85%
Amount of memory
Used Unused
15
Wednesday, September 15, 2010
Swapping steps and
challenges
1.Identify sets of objects and serialize them.
Problems: cycles, speed, etc.
2.Write the serialized objects into a file.
Problems: file format, encoding, speed, etc.
3. Load the objects from a file. Problems: class
reshape, avoid duplicates, speed, etc.
16
Wednesday, September 15, 2010
Subgraphs
A
(Root)
B
(Root)
C
(Root)
D E F G H
Y
K
X
I LJ
Subgraph to process
Z
Roots Inner Shared External
17
Wednesday, September 15, 2010
More
problems
Should shared objects be
included or not?
GC moves objects.
Pointers update.
Class changes.
Recreate and reinitialize
objects.
Code executed after
loading.
A
(Root)
B
(Root)
C
(Root)
D E F G H
Y
K
X
I LJ
Subgraph to process
Z
Roots Inner Shared External
18
Wednesday, September 15, 2010
ImageSegment
Wednesday, September 15, 2010
ImageSegment basis
Only write/swap roots and inner objects.
Shared objects are NOT swapped.
Keep an array in memory for the shared
objects.
Update object pointers to point to a relative
address inside the arrays (offset).
Roots are replaced by proxies.
Uses GC facilities to detect shared objects.
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’
D
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’
D
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’
D
offset
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’ E’
D
offset
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’ E’
D
offset
offset
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’ E’
D
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’ E’
D
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
Subgraph traverse
A CB
D E F G H
I J K L
A’ B’ C’ E’
F GD J
I’ H’ L’
Serialized objects WordArray
Shared objects Array
Wednesday, September 15, 2010
A CB
D E F G H
I J K L
A’ B’ C’ E’
F GD J
I’ H’ L’
Serialized objects WordArray
Shared objects Array
Offset Memory address
Wednesday, September 15, 2010
A CB
D E F G H
I J K L
A’ B’ C’ E’ F GD JI’ H’ L’
Serialized objects WordArray Shared objects Array
anImageSegment
Wednesday, September 15, 2010
D E F G H
I J K L
A’ B’ C’ E’ F GD JI’ H’ L’
Serialized objects WordArray Shared objects Array
anImageSegment
P1 P3P2
Wednesday, September 15, 2010
D E F G H
I J K L
A’ B’ C’ E’ F GD JI’ H’ L’
Serialized objects WordArray Shared objects Array
anImageSegment
P1 P3P2
Wednesday, September 15, 2010
D F G
J K
A’ B’ C’ E’ F GD JI’ H’ L’
Serialized objects WordArray Shared objects Array
anImageSegment
P1 P3P2
Wednesday, September 15, 2010
CB
D F G
J K
A’ B’ C’ E’ I’ H’ L’
Serialized objects WordArray
F GD J
Shared objects Array
anImageSegment
P1 P3P2
Binary file
Wednesday, September 15, 2010
CB
D F G
J K
F GD J
Shared objects Array
anImageSegment
P1 P3P2
Binary file
A’ B’ C’ E’ I’ H’ L’
Wednesday, September 15, 2010
CB
D F G
J K
F GD J
Shared objects Array
anImageSegment
P1 P3P2
Binary file
A’ B’ C’ E’ I’ H’ L’
NIL
Wednesday, September 15, 2010
ImageSegment
conclusions
Good speed.
Graph traverse is done in VM side.
Good use of GC facilities.
You have to be aware of shared objects.
Bad granularity level.
Implicit needed information in object graphs.
Wednesday, September 15, 2010
Thanks!
Mariano Martinez Peck
marianopeck@gmail.com
Wednesday, September 15, 2010

Weitere ähnliche Inhalte

Ähnlich wie Object garphs swapping

Seaside - Why should you care? (Dynamic Stockholm 2010)
Seaside - Why should you care? (Dynamic Stockholm 2010)Seaside - Why should you care? (Dynamic Stockholm 2010)
Seaside - Why should you care? (Dynamic Stockholm 2010)jfitzell
 
RIA Unleashed - Developing for the TV with litl os
RIA Unleashed - Developing for the TV with litl osRIA Unleashed - Developing for the TV with litl os
RIA Unleashed - Developing for the TV with litl osryancanulla
 
JVM Internals - NEJUG Nov 2010
JVM Internals - NEJUG Nov 2010JVM Internals - NEJUG Nov 2010
JVM Internals - NEJUG Nov 2010Doug Hawkins
 
Poisoning Rubinius: The _why and How
Poisoning Rubinius: The _why and HowPoisoning Rubinius: The _why and How
Poisoning Rubinius: The _why and HowBrian Ford
 
Mastering CSS3 Selectors
Mastering CSS3 SelectorsMastering CSS3 Selectors
Mastering CSS3 SelectorsRachel Andrew
 
Modern web application model
Modern web application modelModern web application model
Modern web application modelMichal Taberski
 
Impactos no design com programação funcional
Impactos no design com programação funcionalImpactos no design com programação funcional
Impactos no design com programação funcionalLuiz Costa
 

Ähnlich wie Object garphs swapping (8)

Seaside - Why should you care? (Dynamic Stockholm 2010)
Seaside - Why should you care? (Dynamic Stockholm 2010)Seaside - Why should you care? (Dynamic Stockholm 2010)
Seaside - Why should you care? (Dynamic Stockholm 2010)
 
RIA Unleashed - Developing for the TV with litl os
RIA Unleashed - Developing for the TV with litl osRIA Unleashed - Developing for the TV with litl os
RIA Unleashed - Developing for the TV with litl os
 
JVM Internals - NEJUG Nov 2010
JVM Internals - NEJUG Nov 2010JVM Internals - NEJUG Nov 2010
JVM Internals - NEJUG Nov 2010
 
Poisoning Rubinius: The _why and How
Poisoning Rubinius: The _why and HowPoisoning Rubinius: The _why and How
Poisoning Rubinius: The _why and How
 
06 data
06 data06 data
06 data
 
Mastering CSS3 Selectors
Mastering CSS3 SelectorsMastering CSS3 Selectors
Mastering CSS3 Selectors
 
Modern web application model
Modern web application modelModern web application model
Modern web application model
 
Impactos no design com programação funcional
Impactos no design com programação funcionalImpactos no design com programação funcional
Impactos no design com programação funcional
 

Mehr von Mariano Martínez Peck

Mehr von Mariano Martínez Peck (6)

Clustered Serialization with Fuel
Clustered Serialization with FuelClustered Serialization with Fuel
Clustered Serialization with Fuel
 
PhD Thesis Defense Presentation
PhD Thesis Defense PresentationPhD Thesis Defense Presentation
PhD Thesis Defense Presentation
 
Building you own Pharo images with Metacello
Building you own Pharo images with Metacello Building you own Pharo images with Metacello
Building you own Pharo images with Metacello
 
Visualizing Objects and Memory Usage
Visualizing Objects and Memory UsageVisualizing Objects and Memory Usage
Visualizing Objects and Memory Usage
 
Object swapping issues and the imagesegment implementation
Object swapping issues and the imagesegment implementationObject swapping issues and the imagesegment implementation
Object swapping issues and the imagesegment implementation
 
SqueakDBX
SqueakDBXSqueakDBX
SqueakDBX
 

Kürzlich hochgeladen

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Kürzlich hochgeladen (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Object garphs swapping

  • 1. Object graphs swapping m a r i a n o m a r t i n e z p e c k m a r i a n o p e c k @ g m a i l . c o m RMod 1 Wednesday, September 15, 2010
  • 8. Problem Use more memory than needed. Make OOP languages unsuitable for memory limited devices. Existence of unused but referenced objects. 3 Wednesday, September 15, 2010
  • 9. The context In OOP primary memory is represented by an object graph A B C D E F G H Y K X I LJ Z 4 Wednesday, September 15, 2010
  • 10. Garbage Collector Only collects objects that nobody else points to. A B C D E F G H Y K X I LJ Z 5 Wednesday, September 15, 2010
  • 11. Garbage Collector Only collects objects that nobody else points to. A B C D E F G H Y K X I LJ Z 5 Wednesday, September 15, 2010
  • 12. Garbage Collector Only collects objects that nobody else points to. A B C D E F G H Y K X I LJ Z 5 Wednesday, September 15, 2010
  • 13. Garbage Collector Only collects objects that nobody else points to. A B C D E F G H Y K X I LJ Z 5 Wednesday, September 15, 2010
  • 14. 6 But...what happens with referenced yet unused objects? A B C D E F G H Y K X I LJ Z Wednesday, September 15, 2010
  • 15. Idea Swap out (not remove) unused objects to disk. Automatically load them back when needed. 7 Wednesday, September 15, 2010
  • 16. Related work Large object oriented memory (LOOM). Melt - Supporting memory leaks. ImageSegments. 8 Wednesday, September 15, 2010
  • 17. But...no one solves all the problems 9 Wednesday, September 15, 2010
  • 18. Main challenges Not to use more memory than the one released by swapping. Low overhead penalty. Group objects in an smart way. 10 Wednesday, September 15, 2010
  • 19. Key aspects Mark and trace unused/used objects at runtime. The usage of proxies. Group unused objects (subgraphs). 11 Wednesday, September 15, 2010
  • 20. Why we need to group objects? Because if we replace each object by a proxy, we release little memory. We want to replace a whole group by one or a few proxies. 12 Wednesday, September 15, 2010
  • 21. Why subgraphs? Group of objects that are used (or not used) together. We need few proxies (for the roots) for several objects. 13 Wednesday, September 15, 2010
  • 22. Experiments done Modify Smalltalk VM to mark and trace objects usage. Visualize objects and memory usage. Take statistics from different scenarios. 14 Wednesday, September 15, 2010
  • 23. deployed web application example 4% 96% Amount of objects Used Unused 15% 85% Amount of memory Used Unused 15 Wednesday, September 15, 2010
  • 24. Swapping steps and challenges 1.Identify sets of objects and serialize them. Problems: cycles, speed, etc. 2.Write the serialized objects into a file. Problems: file format, encoding, speed, etc. 3. Load the objects from a file. Problems: class reshape, avoid duplicates, speed, etc. 16 Wednesday, September 15, 2010
  • 25. Subgraphs A (Root) B (Root) C (Root) D E F G H Y K X I LJ Subgraph to process Z Roots Inner Shared External 17 Wednesday, September 15, 2010
  • 26. More problems Should shared objects be included or not? GC moves objects. Pointers update. Class changes. Recreate and reinitialize objects. Code executed after loading. A (Root) B (Root) C (Root) D E F G H Y K X I LJ Subgraph to process Z Roots Inner Shared External 18 Wednesday, September 15, 2010
  • 28. ImageSegment basis Only write/swap roots and inner objects. Shared objects are NOT swapped. Keep an array in memory for the shared objects. Update object pointers to point to a relative address inside the arrays (offset). Roots are replaced by proxies. Uses GC facilities to detect shared objects. Wednesday, September 15, 2010
  • 29. Subgraph traverse A CB D E F G H I J K L Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 30. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 31. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 32. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 33. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 34. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ D Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 35. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ D Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 36. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ D offset Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 37. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ E’ D offset Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 38. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ E’ D offset offset Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 39. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ E’ D Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 40. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ E’ D Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 41. Subgraph traverse A CB D E F G H I J K L A’ B’ C’ E’ F GD J I’ H’ L’ Serialized objects WordArray Shared objects Array Wednesday, September 15, 2010
  • 42. A CB D E F G H I J K L A’ B’ C’ E’ F GD J I’ H’ L’ Serialized objects WordArray Shared objects Array Offset Memory address Wednesday, September 15, 2010
  • 43. A CB D E F G H I J K L A’ B’ C’ E’ F GD JI’ H’ L’ Serialized objects WordArray Shared objects Array anImageSegment Wednesday, September 15, 2010
  • 44. D E F G H I J K L A’ B’ C’ E’ F GD JI’ H’ L’ Serialized objects WordArray Shared objects Array anImageSegment P1 P3P2 Wednesday, September 15, 2010
  • 45. D E F G H I J K L A’ B’ C’ E’ F GD JI’ H’ L’ Serialized objects WordArray Shared objects Array anImageSegment P1 P3P2 Wednesday, September 15, 2010
  • 46. D F G J K A’ B’ C’ E’ F GD JI’ H’ L’ Serialized objects WordArray Shared objects Array anImageSegment P1 P3P2 Wednesday, September 15, 2010
  • 47. CB D F G J K A’ B’ C’ E’ I’ H’ L’ Serialized objects WordArray F GD J Shared objects Array anImageSegment P1 P3P2 Binary file Wednesday, September 15, 2010
  • 48. CB D F G J K F GD J Shared objects Array anImageSegment P1 P3P2 Binary file A’ B’ C’ E’ I’ H’ L’ Wednesday, September 15, 2010
  • 49. CB D F G J K F GD J Shared objects Array anImageSegment P1 P3P2 Binary file A’ B’ C’ E’ I’ H’ L’ NIL Wednesday, September 15, 2010
  • 50. ImageSegment conclusions Good speed. Graph traverse is done in VM side. Good use of GC facilities. You have to be aware of shared objects. Bad granularity level. Implicit needed information in object graphs. Wednesday, September 15, 2010