SlideShare uma empresa Scribd logo
1 de 50
An introduction to Maglev

         Rudi Engelbrecht


               Ruby Conf - 17 June 2011
lautus
MagLev Concepts




lautus            MiniRubyConf
MagLev Concepts
    • Root Object




lautus              MiniRubyConf
MagLev Concepts
    • Root Object
    • Persistency by Reachability




lautus                     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 gems
lautus                        MiniRubyConf
MagLev Concepts
    • Root Object
    • Persistency by Reachability
     • (transitive closure)
    • Repository (Stone)
    • Virtual Machines (Gems)
     • local vs remote gems
    • Garbage Collector
lautus                        MiniRubyConf
Ruby
        VM


       Ruby
        VM    Shared
               Page    Repository
              Cache
Ruby
 VM


Ruby
 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                                      end

lautus                                 MiniRubyConf
TwitterClone
 Maglev.persistent do
  require 'person'
 end

 Maglev::PERSISTENT_ROOT[:persons] = Array.new

 Maglev.commit_transaction




lautus                         MiniRubyConf
person.rb
person.rb




person.rb
:persons

                 Array




  person.rb




person.rb
:persons

                 Array


                             :persons

                                        Array

  person.rb



                         person.rb
person.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

             Array


dhh                  :persons

                                Array
:persons

              Array


dhh    obie           :persons

                                 Array
:persons

              Array


dhh    obie               :persons

               unclebob              Array
:persons

              Array


dhh    obie               :persons

               unclebob              Array
:persons

              Array


dhh    obie               :persons

               unclebob              Array
:persons

              Array


dhh    obie               :persons

               unclebob              Array
:persons

                Array


dhh      obie               :persons

                 unclebob              Array


      noob1
:persons

                Array


dhh      obie               :persons

                 unclebob              Array


      noob1     noob2
:persons

                Array


dhh      obie                 :persons

                 unclebob                    Array


      noob1                 dhh      obie
                noob2
                                              unclebob


                             noob1          noob2
TwitterClone

 persons = Maglev::PERSISTENT_ROOT[:persons]

 persons.each {|p| puts p}




lautus                         MiniRubyConf
TwitterClone




lautus         MiniRubyConf
TwitterClone


    • Multiple VM’s



lautus                MiniRubyConf
TwitterClone


    • Multiple VM’s
    • Concurrent access - MVCC


lautus                  MiniRubyConf
TwitterClone


    • Multiple VM’s
    • Concurrent access - MVCC
    • First commit wins

lautus                  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                                                        end


lautus                                                   MiniRubyConf
TwitterClone2
 Maglev.persistent do
  require 'person'
 end

 Maglev::PERSISTENT_ROOT[:persons] = Array.new

 Maglev.commit_transaction




lautus                         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 << unclebob

lautus                                      MiniRubyConf
TwitterClone2

 persons = Maglev::PERSISTENT_ROOT[:persons]

 persons.each {|p| puts p}




lautus                         MiniRubyConf
MagLev




lautus   MiniRubyConf
MagLev


    • Concurrent access to objects in distributed VM’s



lautus                     MiniRubyConf
MagLev


    • Concurrent access to objects in distributed VM’s
    • Rabbit in hat trick


lautus                     MiniRubyConf
MagLev


    • Concurrent access to objects in distributed VM’s
    • Rabbit in hat trick
    • Proc’s can be persisted

lautus                     MiniRubyConf
MagLev


    • Concurrent access to objects in distributed VM’s
    • Rabbit in hat trick
    • Proc’s can be persisted
     • references enclosing environment’s variables

lautus                         MiniRubyConf
Dinner




lautus   MiniRubyConf
Dinner



    • Enjoy!


lautus         MiniRubyConf

Mais conteúdo relacionado

Mais procurados

#살아있다 #자프링외길12년차 #코프링2개월생존기
#살아있다 #자프링외길12년차 #코프링2개월생존기#살아있다 #자프링외길12년차 #코프링2개월생존기
#살아있다 #자프링외길12년차 #코프링2개월생존기Arawn Park
 
Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)xSawyer
 
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係Kiwamu Okabe
 
Introduction to Moose
Introduction to MooseIntroduction to Moose
Introduction to Moosethashaa
 
Realm: Building a mobile database
Realm: Building a mobile databaseRealm: Building a mobile database
Realm: Building a mobile databaseChristian Melchior
 
JS Level Up: Prototypes
JS Level Up: PrototypesJS Level Up: Prototypes
JS Level Up: PrototypesVernon Kesner
 
Golang slidesaudrey
Golang slidesaudreyGolang slidesaudrey
Golang slidesaudreyAudrey Lim
 
Webinar: MongoDB Persistence with Java and Morphia
Webinar: MongoDB Persistence with Java and MorphiaWebinar: MongoDB Persistence with Java and Morphia
Webinar: MongoDB Persistence with Java and MorphiaMongoDB
 
Why is Haskell so hard! (And how to deal with it?)
Why is Haskell so hard! (And how to deal with it?)Why is Haskell so hard! (And how to deal with it?)
Why is Haskell so hard! (And how to deal with it?)Saurabh Nanda
 
Javascript the New Parts v2
Javascript the New Parts v2Javascript the New Parts v2
Javascript the New Parts v2Federico Galassi
 
Modern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in PerlModern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in PerlNova Patch
 
Moose (Perl 5)
Moose (Perl 5)Moose (Perl 5)
Moose (Perl 5)xSawyer
 
7주 JavaScript 실습
7주 JavaScript 실습7주 JavaScript 실습
7주 JavaScript 실습지수 윤
 

Mais procurados (20)

#살아있다 #자프링외길12년차 #코프링2개월생존기
#살아있다 #자프링외길12년차 #코프링2개월생존기#살아있다 #자프링외길12년차 #코프링2개월생존기
#살아있다 #자프링외길12년차 #코프링2개월생존기
 
Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)
 
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係
 
Realm to Json & Royal
Realm to Json & RoyalRealm to Json & Royal
Realm to Json & Royal
 
Persistens i scala
Persistens i scalaPersistens i scala
Persistens i scala
 
Introduction to Moose
Introduction to MooseIntroduction to Moose
Introduction to Moose
 
Realm: Building a mobile database
Realm: Building a mobile databaseRealm: Building a mobile database
Realm: Building a mobile database
 
JS Level Up: Prototypes
JS Level Up: PrototypesJS Level Up: Prototypes
JS Level Up: Prototypes
 
Golang slidesaudrey
Golang slidesaudreyGolang slidesaudrey
Golang slidesaudrey
 
Webinar: MongoDB Persistence with Java and Morphia
Webinar: MongoDB Persistence with Java and MorphiaWebinar: MongoDB Persistence with Java and Morphia
Webinar: MongoDB Persistence with Java and Morphia
 
Elastic search 검색
Elastic search 검색Elastic search 검색
Elastic search 검색
 
Why is Haskell so hard! (And how to deal with it?)
Why is Haskell so hard! (And how to deal with it?)Why is Haskell so hard! (And how to deal with it?)
Why is Haskell so hard! (And how to deal with it?)
 
1.1 motivation
1.1 motivation1.1 motivation
1.1 motivation
 
Floggy-M3DD-2009-01-21
Floggy-M3DD-2009-01-21Floggy-M3DD-2009-01-21
Floggy-M3DD-2009-01-21
 
Javascript the New Parts v2
Javascript the New Parts v2Javascript the New Parts v2
Javascript the New Parts v2
 
Modern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in PerlModern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in Perl
 
Android Guava
Android GuavaAndroid Guava
Android Guava
 
Moose (Perl 5)
Moose (Perl 5)Moose (Perl 5)
Moose (Perl 5)
 
7주 JavaScript 실습
7주 JavaScript 실습7주 JavaScript 실습
7주 JavaScript 실습
 
Intro to Redis
Intro to RedisIntro to Redis
Intro to Redis
 

Semelhante a Introduction to Ruby MagLev

Maglev Rubyfuza, Cape Town, 2012
Maglev Rubyfuza, Cape Town, 2012Maglev Rubyfuza, Cape Town, 2012
Maglev Rubyfuza, Cape Town, 2012rengelbrecht
 
Ruby - Uma Introdução
Ruby - Uma IntroduçãoRuby - Uma Introdução
Ruby - Uma IntroduçãoÍgor Bonadio
 
Ruby 入門 第一次就上手
Ruby 入門 第一次就上手Ruby 入門 第一次就上手
Ruby 入門 第一次就上手Wen-Tien Chang
 
Ruby 程式語言入門導覽
Ruby 程式語言入門導覽Ruby 程式語言入門導覽
Ruby 程式語言入門導覽Wen-Tien Chang
 
Desarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosDesarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosEdgar Suarez
 
Introductionto fp with groovy
Introductionto fp with groovyIntroductionto fp with groovy
Introductionto fp with groovyIsuru Samaraweera
 
Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2Henry S
 
Postobjektové programovanie v Ruby
Postobjektové programovanie v RubyPostobjektové programovanie v Ruby
Postobjektové programovanie v RubyJano Suchal
 
Rails Model Basics
Rails Model BasicsRails Model Basics
Rails Model BasicsJames Gray
 
Модерни езици за програмиране за JVM (2011)
Модерни езици за програмиране за JVM (2011)Модерни езици за програмиране за JVM (2011)
Модерни езици за програмиране за JVM (2011)Bozhidar Batsov
 
Akka and the Zen of Reactive System Design
Akka and the Zen of Reactive System DesignAkka and the Zen of Reactive System Design
Akka and the Zen of Reactive System DesignLightbend
 
Rails for PHP Developers
Rails for PHP DevelopersRails for PHP Developers
Rails for PHP DevelopersRobert Dempsey
 
Removing Methods (MOTM 2010.01)
Removing Methods (MOTM 2010.01)Removing Methods (MOTM 2010.01)
Removing Methods (MOTM 2010.01)Kevin Munc
 
Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7Brian Hogan
 
Rails workshop for Java people (September 2015)
Rails workshop for Java people (September 2015)Rails workshop for Java people (September 2015)
Rails workshop for Java people (September 2015)Andre Foeken
 
Ruby :: Training 1
Ruby :: Training 1Ruby :: Training 1
Ruby :: Training 1Pavel Tyk
 
Active Support Core Extensions (1)
Active Support Core Extensions (1)Active Support Core Extensions (1)
Active Support Core Extensions (1)RORLAB
 

Semelhante a Introduction to Ruby MagLev (20)

Maglev Rubyfuza, Cape Town, 2012
Maglev Rubyfuza, Cape Town, 2012Maglev Rubyfuza, Cape Town, 2012
Maglev Rubyfuza, Cape Town, 2012
 
Ruby - Uma Introdução
Ruby - Uma IntroduçãoRuby - Uma Introdução
Ruby - Uma Introdução
 
Ruby 入門 第一次就上手
Ruby 入門 第一次就上手Ruby 入門 第一次就上手
Ruby 入門 第一次就上手
 
Ruby 程式語言入門導覽
Ruby 程式語言入門導覽Ruby 程式語言入門導覽
Ruby 程式語言入門導覽
 
Desarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutosDesarrollando aplicaciones web en minutos
Desarrollando aplicaciones web en minutos
 
Groovy unleashed
Groovy unleashed Groovy unleashed
Groovy unleashed
 
Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09
 
Introductionto fp with groovy
Introductionto fp with groovyIntroductionto fp with groovy
Introductionto fp with groovy
 
Profiling Ruby
Profiling RubyProfiling Ruby
Profiling Ruby
 
Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2
 
Postobjektové programovanie v Ruby
Postobjektové programovanie v RubyPostobjektové programovanie v Ruby
Postobjektové programovanie v Ruby
 
Rails Model Basics
Rails Model BasicsRails Model Basics
Rails Model Basics
 
Модерни езици за програмиране за JVM (2011)
Модерни езици за програмиране за JVM (2011)Модерни езици за програмиране за JVM (2011)
Модерни езици за програмиране за JVM (2011)
 
Akka and the Zen of Reactive System Design
Akka and the Zen of Reactive System DesignAkka and the Zen of Reactive System Design
Akka and the Zen of Reactive System Design
 
Rails for PHP Developers
Rails for PHP DevelopersRails for PHP Developers
Rails for PHP Developers
 
Removing Methods (MOTM 2010.01)
Removing Methods (MOTM 2010.01)Removing Methods (MOTM 2010.01)
Removing Methods (MOTM 2010.01)
 
Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7
 
Rails workshop for Java people (September 2015)
Rails workshop for Java people (September 2015)Rails workshop for Java people (September 2015)
Rails workshop for Java people (September 2015)
 
Ruby :: Training 1
Ruby :: Training 1Ruby :: Training 1
Ruby :: Training 1
 
Active Support Core Extensions (1)
Active Support Core Extensions (1)Active Support Core Extensions (1)
Active Support Core Extensions (1)
 

Último

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 

Último (20)

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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 New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 

Introduction to Ruby MagLev

  • 1. An introduction to Maglev Rudi Engelbrecht Ruby Conf - 17 June 2011 lautus
  • 2. MagLev Concepts lautus MiniRubyConf
  • 3. MagLev Concepts • Root Object lautus MiniRubyConf
  • 4. MagLev Concepts • Root Object • Persistency by Reachability lautus MiniRubyConf
  • 5. MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) lautus MiniRubyConf
  • 6. MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) • Repository (Stone) lautus MiniRubyConf
  • 7. MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) • Repository (Stone) • Virtual Machines (Gems) lautus MiniRubyConf
  • 8. MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) • Repository (Stone) • Virtual Machines (Gems) • local vs remote gems lautus MiniRubyConf
  • 9. MagLev Concepts • Root Object • Persistency by Reachability • (transitive closure) • Repository (Stone) • Virtual Machines (Gems) • local vs remote gems • Garbage Collector lautus MiniRubyConf
  • 10. Ruby VM Ruby VM Shared Page Repository Cache Ruby VM Ruby VM
  • 11.
  • 12. 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 end lautus MiniRubyConf
  • 13. TwitterClone Maglev.persistent do require 'person' end Maglev::PERSISTENT_ROOT[:persons] = Array.new Maglev.commit_transaction lautus MiniRubyConf
  • 14.
  • 15.
  • 16.
  • 19. :persons Array person.rb person.rb
  • 20. :persons Array :persons Array person.rb person.rb person.rb
  • 21. 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
  • 22.
  • 23.
  • 24.
  • 25. :persons Array :persons Array
  • 26. :persons Array dhh :persons Array
  • 27. :persons Array dhh obie :persons Array
  • 28. :persons Array dhh obie :persons unclebob Array
  • 29. :persons Array dhh obie :persons unclebob Array
  • 30. :persons Array dhh obie :persons unclebob Array
  • 31. :persons Array dhh obie :persons unclebob Array
  • 32. :persons Array dhh obie :persons unclebob Array noob1
  • 33. :persons Array dhh obie :persons unclebob Array noob1 noob2
  • 34. :persons Array dhh obie :persons unclebob Array noob1 dhh obie noob2 unclebob noob1 noob2
  • 35. TwitterClone persons = Maglev::PERSISTENT_ROOT[:persons] persons.each {|p| puts p} lautus MiniRubyConf
  • 36. TwitterClone lautus MiniRubyConf
  • 37. TwitterClone • Multiple VM’s lautus MiniRubyConf
  • 38. TwitterClone • Multiple VM’s • Concurrent access - MVCC lautus MiniRubyConf
  • 39. TwitterClone • Multiple VM’s • Concurrent access - MVCC • First commit wins lautus MiniRubyConf
  • 40. 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 end lautus MiniRubyConf
  • 41. TwitterClone2 Maglev.persistent do require 'person' end Maglev::PERSISTENT_ROOT[:persons] = Array.new Maglev.commit_transaction lautus MiniRubyConf
  • 42. 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 << unclebob lautus MiniRubyConf
  • 43. TwitterClone2 persons = Maglev::PERSISTENT_ROOT[:persons] persons.each {|p| puts p} lautus MiniRubyConf
  • 44. MagLev lautus MiniRubyConf
  • 45. MagLev • Concurrent access to objects in distributed VM’s lautus MiniRubyConf
  • 46. MagLev • Concurrent access to objects in distributed VM’s • Rabbit in hat trick lautus MiniRubyConf
  • 47. MagLev • Concurrent access to objects in distributed VM’s • Rabbit in hat trick • Proc’s can be persisted lautus MiniRubyConf
  • 48. MagLev • Concurrent access to objects in distributed VM’s • Rabbit in hat trick • Proc’s can be persisted • references enclosing environment’s variables lautus MiniRubyConf
  • 49. Dinner lautus MiniRubyConf
  • 50. Dinner • Enjoy! lautus MiniRubyConf

Notas do Editor

  1. \n
  2. gcgem\n
  3. gcgem\n
  4. gcgem\n
  5. gcgem\n
  6. gcgem\n
  7. gcgem\n
  8. gcgem\n
  9. Logical Architecture\n
  10. Demonstration architecture\nRoot object - carrot orange\n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  30. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  31. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  32. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  33. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  34. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  35. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  36. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  37. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  38. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  39. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  40. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  41. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  42. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  43. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  44. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  45. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  46. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  47. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  48. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  49. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  50. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  51. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  52. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  53. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  54. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  55. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  56. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  57. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  58. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  59. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  60. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  61. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  62. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  63. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  64. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  65. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  66. note the persistence by reachability\ncould also just add dhh\nshow persons[0].followers[0].followers[0].followers[1]\n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. abort transaction\nchange username and refresh in 2nd vm\nnot same as just returning cached instance in vm like other ORM&amp;#x2019;s\n
  76. abort transaction\nchange username and refresh in 2nd vm\nnot same as just returning cached instance in vm like other ORM&amp;#x2019;s\n
  77. abort transaction\nchange username and refresh in 2nd vm\nnot same as just returning cached instance in vm like other ORM&amp;#x2019;s\n
  78. abort transaction\nchange username and refresh in 2nd vm\nnot same as just returning cached instance in vm like other ORM&amp;#x2019;s\n
  79. \n