Object Graph Swapping
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Object Graph Swapping

on

  • 889 views

Object Graph Swapping, Mariano Martinez Peck, ESUG 2010, Barcelona, Spain.

Object Graph Swapping, Mariano Martinez Peck, ESUG 2010, Barcelona, Spain.

Statistics

Views

Total Views
889
Views on SlideShare
889
Embed Views
0

Actions

Likes
1
Downloads
14
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Object Graph Swapping Presentation Transcript

  • 1. Object graphs swapping m a r i a n o m a rt 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 1 Wednesday, September 15, 2010
  • 2. The context 2 Wednesday, September 15, 2010
  • 3. The context 2 Wednesday, September 15, 2010
  • 4. The context 2 Wednesday, September 15, 2010
  • 5. The context 2 Wednesday, September 15, 2010
  • 6. The context 2 Wednesday, September 15, 2010
  • 7. The context 2 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 Z X Y A B C D E F G H I J K L 4 Wednesday, September 15, 2010
  • 10. Garbage Collector Only collects objects that nobody else points to. Z X Y A B C D E F G H I J K L 5 Wednesday, September 15, 2010
  • 11. Garbage Collector Only collects objects that nobody else points to. Z X Y A B C D E F G H I J K L 5 Wednesday, September 15, 2010
  • 12. Garbage Collector Only collects objects that nobody else points to. Z X Y A B C D E F G H I J K L 5 Wednesday, September 15, 2010
  • 13. Garbage Collector Only collects objects that nobody else points to. Z X Y A B C D E F G H I J K L 5 Wednesday, September 15, 2010
  • 14. But...what happens with referenced yet unused objects? Z X Y A B C D E F G H I J K L 6 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 Used Unused Used Unused Amount of objects Amount of memory 4% 15% 85% 96% 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 Roots Inner Shared External X Z Y Subgraph to process A B C (Root) (Root) (Root) D E F G H I J K L 17 Wednesday, September 15, 2010
  • 26. More problems Should shared objects be Roots Inner Shared External included or not? GC moves objects. X Z Y Subgraph to process Pointers update. A B C (Root) (Root) (Root) Class changes. D E F G H Recreate and reinitialize objects. I J K L Code executed after 18 loading. Wednesday, September 15, 2010
  • 27. ImageSegment 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 Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 30. Subgraph traverse A’ B’ C’ Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 31. Subgraph traverse A’ B’ C’ Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 32. Subgraph traverse A’ B’ C’ Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 33. Subgraph traverse A’ B’ C’ Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 34. Subgraph traverse A’ B’ C’ D Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 35. Subgraph traverse A’ B’ C’ D Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 36. Subgraph traverse A’ B’ C’ D Serialized objects WordArray offset Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 37. Subgraph traverse A’ B’ C’ E’ D Serialized objects WordArray offset Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 38. Subgraph traverse offset A’ B’ C’ E’ D Serialized objects WordArray offset Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 39. Subgraph traverse A’ B’ C’ E’ D Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 40. Subgraph traverse A’ B’ C’ E’ D Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 41. Subgraph traverse A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 42. Offset Memory address A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 43. anImageSegment A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 44. anImageSegment A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array P1 P2 P3 D E F G H I J K L Wednesday, September 15, 2010
  • 45. anImageSegment A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array P1 P2 P3 D E F G H I J K L Wednesday, September 15, 2010
  • 46. anImageSegment A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array P1 P2 P3 D F G J K Wednesday, September 15, 2010
  • 47. anImageSegment D F G J A’ B’ C’ E’ I’ H’ L’ Serialized objects WordArray Shared objects Array Binary file P1 P2 B P3 C D F G J K Wednesday, September 15, 2010
  • 48. anImageSegment D F G J Shared objects Array Binary file A’ B’ C’ E’ I’ H’ L’ P1 P2 B P3 C D F G J K Wednesday, September 15, 2010
  • 49. anImageSegment NIL D F G J Shared objects Array Binary file A’ B’ C’ E’ I’ H’ L’ P1 P2 B P3 C D F G J K 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
  • 51. Thanks! Mariano Martinez Peck marianopeck@gmail.com Wednesday, September 15, 2010