maglev: download to deploy - mwrc 2014
DESCRIPTION
MagLev is a Ruby implementation built on top of a mature VM which offers native object persistence. Working with these live objects is awesome - but this image-based development is very different than traditional file-based development. MagLev uses both which has broad reaching effects - from design to deployment.TRANSCRIPT
download to deployJohnnyT
@johnny_t
Who was just
Introduced to Smalltalk
for the first time?
My job is done
The good word
of Smalltalkhas been preached.
Thanks @norelap!
MagLev is an implementation of Ruby which runs on top of the GemStone/S
VM.
What is MagLev?
Before
Ruby
Year 0(1996)
After
Ruby
Year 0(1996)
Matz
Explored theworld of languages
Liked aspects of Perland had visited theIvory Tower of Smalltalk
~10BR(~1986)
Matz
Explored theworld of languages
Liked aspects of Perland had visited theIvory Tower of Smalltalk
18BR(1978)
15BR(1981)
Dan IngallsBYTE Magazine
(1981)
“To be truly object oriented
a system must provide
automatic storage management
(both data and code).”
RUBY_ENGINE“ruby”
rvm 1.9.3
‘puts RUBY_ENGINE’-eruby
“ruby”
MRI
and needs to be preached to the masses
Ruby is awesome!
7AR(2003)
9AR(2005)
DHH
and the land of Java needs some awesome
Ruby is awesome!
12AR(2008)
12AR(2008)
Charles Nutter
Year 0(1996)
JDK v1.0
Why Java?
Threading
RUBY_ENGINE“jruby”
“java”
java jruby-full.jar
‘puts RUBY_ENGINE’-erubyrvm jRuby
let’s go back to our rootsRuby is awesome!
12AR(2008)
12AR(2008)
10BR(1986)
Code
Data
GemStone/S v1.1
OOCL 1.5 billion data objects> 5,800 people in 150 offices globallyFinancial, CS, vendor mgmt, legal, sales
GemStone/S v1.xImprovements from working with OOCL
New classes
Automated trading
GemStone/S v1.y Improvements from working with JP Morgan
New ReducedConflict classes
Install MagLev
Download stone
File in RubyRuby core in the stone
Ruby Core
Data Stores
PostgreSQL
✓ Install✓ Setup
credentials✓ Start daemon
Server Client
login
connection
PostgreSQL
Clientlogin
connection
Execute PL/pgSQL, PL/Perl, PL/Python ...
MagLevClient
login
Shared Page Cache
ClientAttaches to SPCCan execute Ruby as the ‘data manipulation language’
RUBY_ENGINE“maglev”
“maglev”
login
topaz
‘puts RUBY_ENGINE’-erubyrvm jRuby
Object-Relational Impedance Mismatch
Magic, Jobs and Geohashes
Examples
The Hat Trick
hat.rb
rabbit.rb
Abort is not a bad guy
create_hat.rb
Hat Trick
JobQueueLet’s persist some blocks
worker.rb
job.rb
Jobs example
Geohashlatitude, longitude => indexable string
Looking at kids of:root cell.
Precision of 1:
Grid size: 8 x 4Cell count: 32
A cell’s approx size:2.5 million km2
~ size of Australia
MWRC is in themiddle left of the root.
GOTO: 9
Looking at kids of:‘9’.
Precision of 2:
Grid size: 32 x 32Cell count: 1024
A cell’s approx size:781k km2
~ size of UK, Spain or Texas
MWRC is in thetop right of 9
GOTO: 9x
Looking at kids of:‘9x’.
Precision of 3:
Grid size: 256 x 128Cell count: 32k
A cell’s approx size:24k km2
~ size of US County
MWRC is in thebottom left of 9x
GOTO: 9x0
Looking at kids of:‘9x0’.
Precision of 4:
Grid size: 1024 x 1024Cell count: 1.04M
A cell’s approx size:760 km2
~ size of large city
MWRC is in thetop center of 9x0
GOTO: 9x0r
Looking at kids of:‘9x0r’.
Precision of 5:
Grid size: 8192 x 4096Cell count: ~33.5M
A cell’s approx size:24 km2
~ US Postal Code
MWRC is in thetop right of 9x0r
GOTO: 9x0ry
Looking at kids of:‘9x0ry’.
Precision of 6:
Grid size: 32768 x 32768Cell count: ~1.07B
A cell’s approx size:0.73 km2
~ Neighborhood
MWRC is in themiddle left of 9x0ry
GOTO: 9x0ryh
Looking at kids of:‘9x0ryh’.
Precision of 7:
Grid size: 262144 x 1310762Cell count: ~34.36B
A cell’s approx size:23k m2
~ Street
MWRC is in thebottom left of 9x0ryh
GOTO: 9x0ryh0
Looking at kids of:‘9x0ryh0’.
Precision of 8:
Grid size: 1048576 x 1048576Cell count: ~1.09T
A cell’s approx size:726 m2
~ House / Office
MWRC is in themiddle of 9x0ryh0
GOTO: 9x0ryh0k
Looking at kids of:‘9x0ryh0k’.
Precision of 9:
Grid size: 8388608 x 4194304Cell count: ~35T
A cell’s approx size:23 m2
~ Room
MWRC is in themiddle of 9x0ryh0k
GOTO: 9x0ryh0kt
Looking at kids of:‘9x0ryh0kt’.
Precision of 10:
Grid size: 33554432 x 33554432Cell count: ~1Q( 1 e+15 )
A cell’s approx size:0.7 m2
~ Room
JohnnyT is speaking on stage at MWRC in the middle right of 9x0ryh0kt
GOTO: 9x0ryh0ktu
Looking at kids of:‘9x0ryh0ktu’.
Precision of 11:
Grid size: 268435456 x 134217728Cell count: ~36Q( 3.6 e+16 )
A cell’s approx size:222 cm2
~ Room
We made it.Just FYI - my children:
Precision of 12:
Grid size: 1073741824 x 1073741824Cell count: ~36Q( 3.6 e+16 )
A cell’s approx size:7 cm2
~ Deck of cards
1073741824
@char
@parent
@kids0
..
.z
Root Cell
‘’
nil
@char
@parent
@kids0
..
.
0
‘0’
..
.9
@char
@parent
@kidsx
..
.
9
‘9’
@char
@parent
@kids0
..
.
9x
‘x’
@char
@parent
@kidsr
..
.
9x0
‘0’
@char
@parent
@kids...
9x0r
‘r’
Geocell Data Structure
geocell.rb
generator.rb
Thanks!