Edo Cabinet

59
edo cabinet http://tinyurl.com/edocabinet Sunday, July 19, 2009

description

Tokyo Cabinet|Tyrant, Ruby FFI, rufus-tokyo

Transcript of Edo Cabinet

edocabinet

http://tinyurl.com/edocabinetSunday, July 19, 2009

ruby andtokyo cabinet

http://www.flickr.com/photos/kiim/3185168797/Sunday, July 19, 2009

jmettraux

swiss guywants to write less codeends up writing too much

http://github.com/jmettraux/Sunday, July 19, 2009

why rufus-tokyo ?

need to persist data quickly

Sunday, July 19, 2009

Tokyo Cabinet|Tyrant

key/value store

persistent

fast, fast, fast

http://tokyocabinet.sourceforge.net/Sunday, July 19, 2009

Hirabyashi-san is providing ruby bindings

but no “sudo gem install”

and it’s ‘extconf’

and ...

http://tokyocabinet.sourceforge.net/rubydoc/Sunday, July 19, 2009

Sunday, July 19, 2009

what I want

{ }

Sunday, July 19, 2009

Sunday, July 19, 2009

what I want

what I built

Sunday, July 19, 2009

rufus-tokyo

ruby gem

Tokyo CabinetTokyo Tyrant

ruby FFI

Sunday, July 19, 2009

http://blog.headius.com/2008/10/ffi-for-ruby-now-available.htmlSunday, July 19, 2009

ruby FFI

Sunday, July 19, 2009

FFI

Foreign Function Interface

common lisphaskell

Sunday, July 19, 2009

ruby FFI

from Rubinius

thanks to Wayne Meissner

to jruby and ruby

http://wmeissner.blogspot.com/2008/11/more-on-ruby-ffi.htmlSunday, July 19, 2009

ruby FFI

an example

the ‘crypt’ function

Sunday, July 19, 2009

Sunday, July 19, 2009

http://files.getdropbox.com/u/76595/rk_crypt.rbSunday, July 19, 2009

ruby FFI

an example

‘uuid_generate’

Sunday, July 19, 2009

http://files.getdropbox.com/u/76595/rk_uuid.rbSunday, July 19, 2009

ruby FFI flow

1) attach functions2) call functions

Sunday, July 19, 2009

ruby FFI

an example

libevent

Sunday, July 19, 2009

http://files.getdropbox.com/u/76595/rk_libev.rbSunday, July 19, 2009

http://files.getdropbox.com/u/76595/rk_libev.rbSunday, July 19, 2009

Sunday, July 19, 2009

ruby FFI

more fun

from ruby to lua

Sunday, July 19, 2009

http://jmettraux.wordpress.com/2009/03/16/ruby-to-lua/Sunday, July 19, 2009

http://github.com/remogatto/ffi-inliner/Sunday, July 19, 2009

Sunday, July 19, 2009

Tokyo Cabinet|Tyrant

Sunday, July 19, 2009

Mikio Hirabayashi is the author

mixi.jp is the source

http://tokyocabinet.sourceforge.net/index.htmlSunday, July 19, 2009

http://alpha.mixi.co.jp/blog/?author=3Sunday, July 19, 2009

http://www.slideshare.net/estraier/introduction-to-tokyo-productsSunday, July 19, 2009

Sunday, July 19, 2009

rufus-tokyo

Sunday, July 19, 2009

2 products

Tokyo Cabinetlocal file

Tokyo Tyrantremote cabinet fileover TCP socket (or Unix socket)

Sunday, July 19, 2009

local cabinet lib

Sunday, July 19, 2009

remote tyrant server

cabinet lib

Sunday, July 19, 2009

ttmemcached

httptyrant server

cabinet lib

Sunday, July 19, 2009

2 flavours

- key/value (abstract)

- key/hash of values (table)

Sunday, July 19, 2009

{ k => v } { k => { k => v } }

hash

tableB+ tree table

fixed length

table

Sunday, July 19, 2009

{ k => v } { k => { k => v } }

abstract table

Sunday, July 19, 2009

key/value

like { }

Sunday, July 19, 2009

Sunday, July 19, 2009

key/hash of values (table)

like a { pk => { } }

Sunday, July 19, 2009

Sunday, July 19, 2009

Sunday, July 19, 2009

locallocal remoteremote

Rufus::Tokyo::Cabinet

Rufus::Tokyo::Table

Rufus::Tokyo::Tyrant

Rufus::Tokyo::TyrantTable

{ } { pk => { } } { } { pk => { } }

1 access1 access1+ accesses

lua embedded1+ accesses

lua embedded

Sunday, July 19, 2009

tt-src $ .configure --enable-luatt-src $ makett-src $ sudo make install

http://openwferu.rubyforge.org/tokyo.htmlSunday, July 19, 2009

http://jmettraux.wordpress.com/2009/04/07/rufus-tokyo-0112-extlua/Sunday, July 19, 2009

http://www.igvita.com/2009/07/13/extending-tokyo-cabinet-db-with-lua/Sunday, July 19, 2009

Sunday, July 19, 2009

Rufus::Edo

Sunday, July 19, 2009

FFI

+ ruby, jruby+ no compilation when ‘gem install’

- slower than classical c extension

=> Rufus::Edo

Sunday, July 19, 2009

Sunday, July 19, 2009

locallocal remoteremote

Rufus::Tokyo::Rufus::Tokyo::Rufus::Tokyo::Rufus::Tokyo::

FFI Cabinet Table Tyrant TyrantTable

Rufus::Edo::Rufus::Edo::Rufus::Edo::Rufus::Edo::

c ext Cabinet Table ? ?

pure ruby NetTyrant NetTyrantTable

Sunday, July 19, 2009

ruby to tyrant, the fastest

http://github.com/actsasflinn/ruby-tokyotyrant/

ruby c extension for Tyrant

rufus-tokyo friendly

Sunday, July 19, 2009

many thanks to

Mikio HirabayashiZev BlutIlya GrigorikJustin ReagorFlinn MullerWayne E. SeguinMatthew KingYuki SatowWayne MeissnerKim Erlandsen (picture)and many others

Sunday, July 19, 2009