Professional Documents
Culture Documents
FlockDB URUG (June 22, 2010)
FlockDB URUG (June 22, 2010)
1
What?
2
What? (cont.)
• 13 billion edges
• scales horizontally
3
Graph what?
• neo4j
4
Smörgåsbord of Tech
• Java 1.6+,
• Scala
• Ruby 1.8
• MySQL 5+
• thrift 0.2
5
Features
• Sharding
• Thrift interface
• “Transactions”
• State
• Compound queries
• Result paging
• “Migrations”
6
Thrift Interface
• Apache incubator
• Polyglot
• C++, Java, Python, PHP, Ruby, Erlang,
Perl, Haskell, C#, Cocoa, Smalltalk, and
OCaml
• Ruby client
7
“Transactions”
8
Transactions - Code
>> flock.transaction do |t|
>> t.add(1, :follows, 20)
>> t.add(1, :follows, 30)
>> end
=> nil
Mass Actions
>> flock.remove(29, :follows, nil)
9
State
1
State - Code
1
Simple Queries
1
Compound Queries
1
CQ - Code
• Ex, Do I follow anyone that follows Justin Bieber?
>> flock.select(1, :follows, nil).intersect(nil, :follows, 20).to_a
=> []
• Union
>> flock.select(1, :follows, nil).union(nil, :follows, 1).to_a
=> [2,3,47]
=>[3,4,7]
1
Result Paging
>> p.next_page
1
Migrations
1
Install FlockDB
• sbt “soon”
1
How to use
• Setup some environment variables
export DB_USERNAME=”root”
export DB_PASSWORD=”password”
• Run setup-env.sh
• kills / restarts flock
• creates dev database
• runs flocker to create shards
• Ask where a shard is stored
./src/scripts/flocker.rb -D find 1 --graph 1
1
Under the Hood
• http://engineering.twitter.com/2010/05/introducing-flockdb.html
• http://github.com/twitter/flockdb
• http://github.com/twitter/flockdb-client/tree/
• http://en.wikipedia.org/wiki/Graph_database
• http://incubator.apache.org/thrift/
• http://github.com/twitter/gizzard