• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Introduction to Ruby MagLev
 

Introduction to Ruby MagLev

on

  • 1,319 views

These slides show a high level architecture of Ruby MagLev as well as a small example to illustrate how easy it is to have transparent object persistence in Ruby.

These slides show a high level architecture of Ruby MagLev as well as a small example to illustrate how easy it is to have transparent object persistence in Ruby.

Statistics

Views

Total Views
1,319
Views on SlideShare
1,317
Embed Views
2

Actions

Likes
0
Downloads
10
Comments
0

2 Embeds 2

https://twitter.com 1
http://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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
  • \n
  • gcgem\n
  • gcgem\n
  • gcgem\n
  • gcgem\n
  • gcgem\n
  • gcgem\n
  • gcgem\n
  • Logical Architecture\n
  • Demonstration architecture\nRoot object - carrot orange\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • abort transaction\nchange username and refresh in 2nd vm\nnot same as just returning cached instance in vm like other ORM’s\n
  • abort transaction\nchange username and refresh in 2nd vm\nnot same as just returning cached instance in vm like other ORM’s\n
  • abort transaction\nchange username and refresh in 2nd vm\nnot same as just returning cached instance in vm like other ORM’s\n
  • abort transaction\nchange username and refresh in 2nd vm\nnot same as just returning cached instance in vm like other ORM’s\n
  • \n

Introduction to Ruby MagLev Introduction to Ruby MagLev Presentation Transcript

  • An introduction to Maglev Rudi Engelbrecht Ruby Conf - 17 June 2011lautus
  • MagLev Conceptslautus MiniRubyConf
  • MagLev Concepts • Root Objectlautus MiniRubyConf
  • MagLev Concepts • Root Object • Persistency by Reachabilitylautus MiniRubyConf
  • MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure)lautus MiniRubyConf
  • MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) • Repository (Stone)lautus MiniRubyConf
  • MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) • Repository (Stone) • Virtual Machines (Gems)lautus MiniRubyConf
  • MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) • Repository (Stone) • Virtual Machines (Gems) • local vs remote gemslautus MiniRubyConf
  • MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) • Repository (Stone) • Virtual Machines (Gems) • local vs remote gems • Garbage Collectorlautus MiniRubyConf
  • Ruby VM Ruby VM Shared Page Repository CacheRuby VMRuby VM
  • TwitterClone class Person def remove_follower(person) @followers.delete(person) attr_accessor :username, :followers end def initialize(username) def to_s @username = username result = "@#{@username} --> @followers = Array.new [#{@followers.size}]" end @followers.each {|f| result = result + " #{f.username}" } def add_follower(person) result @followers << person end end endlautus MiniRubyConf
  • TwitterClone Maglev.persistent do require person end Maglev::PERSISTENT_ROOT[:persons] = Array.new Maglev.commit_transactionlautus MiniRubyConf
  • person.rb
  • person.rbperson.rb
  • :persons Array person.rbperson.rb
  • :persons Array :persons Array person.rb person.rbperson.rb
  • TwitterClone require person dhh = Person.new("dhh") persons = obie = Person.new("obie") Maglev::PERSISTENT_ROOT[:persons] unclebob = Person.new("unclebob") noob1 = Person.new("noob1") persons << dhh noob2 = Person.new("noob2") persons << obie persons << unclebob dhh.add_follower(obie) dhh.add_follower(unclebob) Maglev.commit_transaction obie.add_follower(unclebob) unclebob.add_follower(noob1) unclebob.add_follower(noob2)lautus MiniRubyConf
  • :persons Array :persons Array
  • :persons Arraydhh :persons Array
  • :persons Arraydhh obie :persons Array
  • :persons Arraydhh obie :persons unclebob Array
  • :persons Arraydhh obie :persons unclebob Array
  • :persons Arraydhh obie :persons unclebob Array
  • :persons Arraydhh obie :persons unclebob Array
  • :persons Arraydhh obie :persons unclebob Array noob1
  • :persons Arraydhh obie :persons unclebob Array noob1 noob2
  • :persons Arraydhh obie :persons unclebob Array noob1 dhh obie noob2 unclebob noob1 noob2
  • TwitterClone persons = Maglev::PERSISTENT_ROOT[:persons] persons.each {|p| puts p}lautus MiniRubyConf
  • TwitterClonelautus MiniRubyConf
  • TwitterClone • Multiple VM’slautus MiniRubyConf
  • TwitterClone • Multiple VM’s • Concurrent access - MVCClautus MiniRubyConf
  • TwitterClone • Multiple VM’s • Concurrent access - MVCC • First commit winslautus MiniRubyConf
  • TwitterClone2 def add_follower(person) class Person @followers << person attr_accessor :username, :email, :followers, :following end def initialize(username) def remove_follower(person) @username = username @followers.delete(person) @email = username + "@mail.com" end @followers = Array.new @following = Array.new def to_s end result = "@#{@username} --> [#{@following.size} : #{@followers.size}]" def follows(person) result = result + " following: {" @following << person @following.each {|f| result = result + " #{f.username}"} person.add_follower(self) result = result + " }" end result = result + " followed by: {" @followers.each {|f| result = result + " #{f.username}"} def unfollows(person) result = result + " }" @following.delete(person) result person.remove_follower(self) end end endlautus MiniRubyConf
  • TwitterClone2 Maglev.persistent do require person end Maglev::PERSISTENT_ROOT[:persons] = Array.new Maglev.commit_transactionlautus MiniRubyConf
  • TwitterClone2 require person dhh = Person.new("dhh") obie = Person.new("obie") unclebob = Person.new("unclebob") noob1 = Person.new("noob1") noob2 = Person.new("noob2") obie.follows(dhh) unclebob.follows(dhh) unclebob.follows(obie) noob1.follows(unclebob) noob2.follows(unclebob) persons = Maglev::PERSISTENT_ROOT[:persons] persons << dhh persons << obie persons << uncleboblautus MiniRubyConf
  • TwitterClone2 persons = Maglev::PERSISTENT_ROOT[:persons] persons.each {|p| puts p}lautus MiniRubyConf
  • MagLevlautus MiniRubyConf
  • MagLev • Concurrent access to objects in distributed VM’slautus MiniRubyConf
  • MagLev • Concurrent access to objects in distributed VM’s • Rabbit in hat tricklautus MiniRubyConf
  • MagLev • Concurrent access to objects in distributed VM’s • Rabbit in hat trick • Proc’s can be persistedlautus MiniRubyConf
  • MagLev • Concurrent access to objects in distributed VM’s • Rabbit in hat trick • Proc’s can be persisted • references enclosing environment’s variableslautus MiniRubyConf
  • Dinnerlautus MiniRubyConf
  • Dinner • Enjoy!lautus MiniRubyConf