Successfully reported this slideshow.
Your SlideShare is downloading. ×

Cassandra for Rails

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
Bigtable
Bigtable
Loading in …3
×

Check these out next

1 of 51 Ad

More Related Content

Similar to Cassandra for Rails (20)

Recently uploaded (20)

Advertisement

Cassandra for Rails

  1. 1. A highly scalable, eventually consistent, distributed, structured key-value store. Wednesday, December 16, 2009
  2. 2. Why • Scaling existing Relational Databases is hard. • Sharding is one solution, but makes your RDBMS unusuable. • Operational Nightmare. Wednesday, December 16, 2009
  3. 3. The Bigdata Age • Scale horizontally, just add more servers • Cluster growth. Load balance automatically • Flexible schemas • Key-Oriented Queries • High Availability, 24 x 7 x 365 Wednesday, December 16, 2009
  4. 4. Cassandra Design • High availability. • Eventual consistency. • Incremental scalability. • Optimistic Replication. • Low total cost of ownership. • Tunable tradeoffs between consistency & latency. • Minimal administration. Wednesday, December 16, 2009
  5. 5. General Data Models "contents:" "anchor:cnnsi.com" "anchor:my.look.ca" Key-Value "<html>..." t3 "com.cnn.www" <html> "<html>..." t5 "CNN" t9 "CNN.com" t8 "<html>..." t6 Figure 1: A slice of an example table that stores Web pages. The row name is a reversed URL. The contents column family con- tains the page contents, and the anchor column family contains the text of any anchors that reference the page. CNN’s home page "contents:" "anchor:cnnsi.com" "anchor:my.look.ca" is referenced by both the Sports Illustrated and the MY-look home pages, so the row contains columns named anchor:cnnsi.com Key-Columns and anchor:my.look.ca. Each anchor cell has one version; the contents column has three versions, at timestamps t 3 , t5 , and t6 . "<html>..." t "com.cnn.www" "<html>..."a variety3 t5 "CNN" t "CNN.com" t8 We settled on this data model after examining "<html>..." Column Families 9 t6 of potential uses of a Bigtable-like system. As one con- crete example that drove some of our design decisions, Column keys are grouped into sets called column fami- suppose we want to keep a copy of a large collection of lies, which form the basic unit of access control. All data web pages and related information that could be used by stored in a column family is usually of the same type (we Figure 1: A slice of an example table that stores Web pages. The compress a reversed URL. The contents column family con- many different projects; let us call this particular table row name is data in the same column family together). A tains the page contents, and the anchor column family contains the column family must be createdthe page. CNN’s home page text of any anchors that reference before data can be stored the Webtable. In Webtable, we would use URLs as row under any row contains columns named anchor:cnnsi.com is referenced by both the Sports Illustrated and the MY-look home pages, so thecolumn key in that family; after a family has keys, various aspects ofEach anchor as column names, and contents column has three versions, at timestamps t , t , and t . and anchor:my.look.ca. web pages cell has one version; the been created, any column key within the family can be 3 5 6 store the contents of the web pages in the contents: col- umn under the timestamps when they were fetched, as used. It is our intent that the number of distinct column Bigtable: Ain a table be small (in the hundreds at most), - Google Inc families Families Storage System for Structured Data and Distributed illustrated in Figure 1. model after examining a variety We settled on this data Column of potential uses16, 2009 of a Bigtable-like system. As one con- that families rarely change during operation. In contrast, Wednesday, December
  6. 6. General Data Models "contents:" "anchor:cnnsi.com" "anchor:my.look.ca" Key-Value "<html>..." t3 "com.cnn.www" <html> "<html>..." t5 "CNN" t9 "CNN.com" t8 "<html>..." t6 Figure 1: A slice of an example table that stores Web pages. The row name is a reversed URL. The contents column family con- tains the page contents, and the anchor column family contains the text of any anchors that reference the page. CNN’s home page "contents:" "anchor:cnnsi.com" "anchor:my.look.ca" is referenced by both the Sports Illustrated and the MY-look home pages, so the row contains columns named anchor:cnnsi.com Key-Columns and anchor:my.look.ca. Each anchor cell has one version; the contents column has three versions, at timestamps t 3 , t5 , and t6 . "<html>..." t "com.cnn.www" "<html>..."a variety3 t5 "CNN" t "CNN.com" t8 We settled on this data model after examining "<html>..." Column Families 9 t6 of potential uses of a Bigtable-like system. As one con- crete example that drove some of our design decisions, Column keys are grouped into sets called column fami- suppose we want to keep a copy of a large collection of lies, which form the basic unit of access control. All data Column Family web pages and related information that could be used by stored in a column Family usually of the same type (we Column family is Figure 1: A slice of an example table that stores Web pages. The compress a reversed URL. The contents column family con- many different projects; let us call this particular table row name is data in the same column family together). A tains the page contents, and the anchor column family contains the column family must be createdthe page. CNN’s home page text of any anchors that reference before data can be stored the Webtable. In Webtable, we would use URLs as row under any row contains columns named anchor:cnnsi.com is referenced by both the Sports Illustrated and the MY-look home pages, so thecolumn key in that family; after a family has keys, various aspects ofEach anchor as column names, and contents column has three versions, at timestamps t , t , and t . andColumn Family web pages cell has one version; the Group” in Google’s Bigtable terminologycan be anchor:my.look.ca. is also named a “Locality been created, any column key within the family 6 3 5 store the contents of the web pages in the contents: col- umn under the timestamps when they were fetched, as used. It is our intent that the number of distinct column Bigtable: Ain a table be small (in the hundreds at most), - Google Inc families Families Storage System for Structured Data and Distributed illustrated in Figure 1. model after examining a variety We settled on this data Column of potential uses16, 2009 of a Bigtable-like system. As one con- that families rarely change during operation. In contrast, Wednesday, December
  7. 7. STORAGE LAYOUTS Wednesday, December 16, 2009
  8. 8. Row-based Storage Row-Based storage • Pros:GoodRead/Write of adisk and in cache) in Pros: single row a single IO operation locality of access (on of different columns • Cons:Cons: If you a single row scan a IO operation. Read/write of want to is a single only one column youscan only one column, you still But if you want to still read all data. read all. Design Patterns for Distributed Non-Relational Databases - Todd Lipcon, Cloudera Wednesday, December 16, 2009
  9. 9. Columnar Storage Columnar storage • Pros: good locality of access for Pros: differentfor a given column is stored sequentially Data columns Scanning a single column (eg aggregate queries) is • Cons: Reading a single row may fast seek once per column Cons: Reading a Design Patterns for Distributed Non-Relational Databases - Todd Lipcon, Cloudera single row may seek once per column. Wednesday, December 16, 2009
  10. 10. Columnar Storage with Locality Groups with Column Family • Pros: Scanning a single column (aggregate queries) is fast Columns are organized into families (“locality groups”) • Cons: Reading a single row may Benefits of row-based layout within a group. seek once per column Benefits of column-based - Non-Relational have- Todd Lipcon, Cloudera Design Patterns for Distributed don’t Databases to read groups you don’t care about. Wednesday, December 16, 2009
  11. 11. Log Structured Merge Trees Convert random writes to sequential writes. • Writes go to a commit log and in-memory storage (Memtable) • The Memtable is occasionally flushed to disk (SSTable) • The SSTables are periodically compacted into one. The log-structured merge-tree (LSM-tree) P. E. O’Neil, E. Cheng, D. Gawlick, and E. J. O’Neil. Wednesday, December 16, 2009
  12. 12. Write Operations Write Read Memtable RAM Commit Log SSTable (DISK) SSTable DISK SSTable Wednesday, December 16, 2009
  13. 13. Read Operations Write Read Memtable RAM Commit Log SSTable (DISK) SSTable DISK SSTable Wednesday, December 16, 2009
  14. 14. Read Operations Write Read Memtable RAM Commit Log SSTable (DISK) SSTable DISK SSTable Bloom Filter Wednesday, December 16, 2009
  15. 15. Flush Memtable Write Read Memtable RAM Commit Log SSTable (DISK) SSTable DISK SSTable Wednesday, December 16, 2009
  16. 16. Flush Memtable RAM SSTable 4 SSTable 3 (DISK) SSTable 2 DISK SSTable 1 Wednesday, December 16, 2009
  17. 17. Compactation RAM SSTable 4 SSTable 3 (DISK) SSTable 2 SSTable 1' DISK SSTable 1 Merge Sort Wednesday, December 16, 2009
  18. 18. Compactation RAM (DISK) SSTable 1' DISK Wednesday, December 16, 2009
  19. 19. Write Operations Write Read Memtable RAM Commit Log SSTable (DISK) SSTable SSTable 1' DISK SSTable Wednesday, December 16, 2009
  20. 20. WRITE PROPERTIES • No locks in the critical path • Sequential disk access • Behaves like a write back Cache • Append support without read ahead • Atomicity guarantee for a key • “Always Writable” –accept writes during failure scenarios Wednesday, December 16, 2009
  21. 21. CAP Theorem • CONSISTENCY: ...how and whether a system is left in a consistent state after an operation. • AVAILABILITY: refers to system such that it is ensured to remain operational over some period of time. • PARTITION-TOLERANCE: Ability for a system to continue to operate in the presence of a network partitions. Wednesday, December 16, 2009
  22. 22. Eventual Consistency • As t! !, readers will see writes. • In a steady state, the system is guaranteed to eventually return the las written value. • Examples: DNS or MySQL slave replication. Wednesday, December 16, 2009
  23. 23. Partitioning Scheme: Consistent Hashing h(key) Wednesday, December 16, 2009
  24. 24. Partitioning Scheme: Consistent Hashing key previously owned by A Wednesday, December 16, 2009
  25. 25. Partitioning Scheme: Consistent Hashing Wednesday, December 16, 2009
  26. 26. Partitioning Scheme: Replication N=3 Wednesday, December 16, 2009
  27. 27. Read Repair Client Query Result Cassandra Cluster Closest replica Result Replica A Digest Query Digest Response Digest Response Replica B Replica C Wednesday, December 16, 2009
  28. 28. Read Repair Client Query Result Cassandra Cluster Closest replica Result Read repair if digests differ Replica A Digest Query Digest Response Digest Response Replica B Replica C Wednesday, December 16, 2009
  29. 29. Cluster Memebership • Gossip protocol is used for cluster membership. • Super lightweight with mathematically provable properties. • State disseminated in O(log2 N) rounds where N is the number of nodes in the cluster. • A member merges the list with its own list. • Every T seconds each member increments its heartbeat counter and selects one other member to send its list to. Wednesday, December 16, 2009
  30. 30. Gossip Algorithm Wednesday, December 16, 2009
  31. 31. Gossip Algorithm: Round 1 Wednesday, December 16, 2009
  32. 32. Gossip Algorithm: Round 2 Wednesday, December 16, 2009
  33. 33. Gossip Algorithm: Round 3 Wednesday, December 16, 2009
  34. 34. Gossip Algorithm: Round 4 Wednesday, December 16, 2009
  35. 35. DATA MODEL Wednesday, December 16, 2009
  36. 36. Hierarchy • ClusterName • KeySpace / Database / Delicious • ColumFamily / Table / Users • key / ID / 12345 • column / Attribute / email Wednesday, December 16, 2009
  37. 37. DATA MODEL:Columns COLUMN FAMILY: Users Name Name Name Name Name !"# Value Value Value Value Value Timestamp Timestamp Timestamp Timestamp Timestamp name lastname likes $%&'()( Pablo Delgado Sugar #timestamp #timestamp #timestamp name lastname %*)+*,+ Antonio Garrote #timestamp #timestamp name lastname age language updated_at -%./+ Mauro Pompilio 25 es 2009/05/03 #timestamp #timestamp #timestamp #timestamp #timestamp Wednesday, December 16, 2009
  38. 38. DATA MODEL:Columns COLUMN FAMILY: Users Name Name Name Name Name !"# Value Value Value Value Value Timestamp Timestamp Timestamp Timestamp Timestamp name lastname likes ordered column keys $%&'()( Pablo Delgado Sugar #timestamp #timestamp #timestamp name lastname %*)+*,+ Antonio Garrote #timestamp #timestamp name lastname age language updated_at -%./+ Mauro Pompilio 25 es 2009/05/03 #timestamp #timestamp #timestamp #timestamp #timestamp ordered keys Wednesday, December 16, 2009
  39. 39. DATA MODEL: SuperColumns COLUMN FAMILY: Tags Name Name Name KEY beach mountain pablete Wednesday, December 16, 2009
  40. 40. DATA MODEL: SuperColumns COLUMN FAMILY: Tags Name Name Name KEY beach mountain ordered supercolumn keys pablete ordered keys Wednesday, December 16, 2009
  41. 41. DATA MODEL: SuperColumns COLUMN FAMILY: Tags Name Name Name Name Name Name Name Name Name Name Title Title Title Title Title Title Title KEY Name Name Name Name Title Title Title Title beach mountain 9876 843 777 1234 san-diego barcelona cadaques barcelona pablete 654 555 78 888 niza sicilia trapani andorra Wednesday, December 16, 2009
  42. 42. DATA MODEL: SuperColumns COLUMN FAMILY: Tags Name Name Name Name Name Name Name Name Name Name Title Title Title Title Title Title Title KEY Name Name Name Name Title Title Title Title beach mountain ordered supercolumn keys 9876 843 777 1234 san-diego barcelona cadaques barcelona ordered column keys pablete 654 555 78 888 niza sicilia trapani andorra ordered keys Wednesday, December 16, 2009
  43. 43. Ruby Thrift Client !"#$%!"&'()*+,,+-.!+' !"#$%!"&'()*+,,+-.!+/*0-,1+-1,' !"#$%!"&'()*+,,+-.!+/123",' !"#$%!"&'33' 1!+-,30!1&4&56!%71889$77"!".5!+-,30!1(-":;56!%7188<0*="1(-":;>?0*+?60,1>@&>ABCD>EE 1!+-,30!1(03"- *?%"-1&4&F+,,+-.!+56!%7188F+,,+-.!+88F?%"-1(-":;56!%71889%-+!2G!010*0?(-":;1!+-,30!1EE ="2,3+*"&4&>9?0H> ="2&4&>.$."/?0H%-> *0?$I-G+16&4&F+,,+-.!+56!%7188F0?$I-G+16(-":;8*0?$I-/7+I%?2&4J&>K,"!,>@&8*0?$I-&4J&>"I+%?>E L+?$"&4&>.$."M"N+I3?"(*0I> 1&4&5%I"(-0: 1%I",1+I3&4&1(10/%&O&B/DDD/DDD&P&1($,"* *?%"-1(%-,"!1;="2,3+*"@&="2&@*0?$I-G+16@&L+?$"@&1%I",1+I3@&F+,,+-.!+56!%7188F0-,%,1"-*2Q"L"?88RSTUE V"H%- &&33&*?%"-1(H"1;="2,3+*"@&="2@&*0?$I-G+16@&F+,,+-.!+56!%7188F0-,%,1"-*2Q"L"?88UWSE !",*$"&F+,,+-.!+56!%7188W01X0$-.SN*"31%0-&4J&" &&3$1,&>Y"2&-01&70$-.(> "-. Z4J&'.$."M+:",0I"(*0I' http://wiki.apache.org/cassandra/ClientExamples Wednesday, December 16, 2009
  44. 44. Ruby with Cassandra gem !"#$%!"&'!$V2H"I,' !"#$%!"&'*+,,+-.!+' !"#$%!"&'33' %-*?$."&F+,,+-.!+88F0-,1+-1, *?%"-1&4&F+,,+-.!+(-":;'9?0H'@&>B[(D(D(B8ABCD>E Z&FUQK]W< *?%"-1(%-,"!1;8K,"!,@&'+:",0I".$."'@&^'"I+%?'&4J&'.$."M+:",0I"(*0I'_E *0?$I-,&4&*?%"-1(H"1;8K,"!,@&'+:",0I".$."'E 33&*0?$I-,`'"I+%?'a Z4J&'.$."M+:",0I"(*0I' Z&<KGSTFUQK]W< *?%"-1(%-,"!1;85+H,@&'+:",0I".$."'@&^'V"+*6'&4J&^KKbc(-":&4J&',+-.%"H0'__E *?%"-1(%-,"!1;85+H,@&'+:",0I".$."'@&^'V"+*6'&4J&^KKbc(-":&4J&'V+!*"?0-+'__E *?%"-1(%-,"!1;85+H,@&'+:",0I".$."'@&^'I0$-1+%-'&4J&^KKbc(-":&4J&>V+!*"?0-+>@&KKbc(-":&4J&>+-.0!!+>__E &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 1+H,&4&*?%"-1(H"1;85+H,@&'+:",0I".$."'E 33&1+H,(="2, Z4J&`>V"+*6>@>I0$-1+%->a 1+H,&4&*?%"-1(H"1;85+H,@&'+:",0I".$."'@'V"+*6'E 33&30,1/="2,&4&1+H,(I+3&^&d1%I",1+I3@&="2d&="2&_ Z4J&`>,+-.%"H0>@&>V+!*"?0-+>a *?%"-1(!"I0L";85+H,@&'+:",0I".$."'E http://github.com/fauna/cassandra Wednesday, December 16, 2009
  45. 45. Ruby with CassandraObject (Rails 3) *?+,,&F$,10I"!&e&F+,,+-.!+UVf"*1889+," &&+11!%V$1"&87%!,1/-+I"@&8123"&&&&4J&<1!%-H &&+11!%V$1"&8?+,1/-+I"@&8123"&&&&&4J&<1!%-H &&+11!%V$1"&8.+1"/07/V%!16@&8123"&4J&c+1" &&+11!%V$1"&83!"7"!"-*",@&8123"&&&4J&g+,6 &&L+?%.+1"&8,60$?./V"/*00? &&="2&8$$%. &&%-."N&8?+,1/-+I"@&8!"L"!,".&4J&1!$" &&+,,0*%+1%0-&8%-L0%*",@&8$-%#$"&4J&7+?,"@&8%-L"!,"/07&4J&8*$,10I"!@&8!"L"!,".&4J&1!$" &&3!%L+1" &&."7&,60$?./V"/*00? &&&&$-?",,&`>]%*6+"?>@&>h-%=+>@&>SL+->a(%-*?$."i;7%!,1/-+I"E &&&&&&"!!0!,(+..;87%!,1/-+I"@&>I$,1&V"&16+1&07&+&*00?&3"!,0->E &&&&"-. &&"-. "-. http://github.com/NZKoz/cassandra_object Wednesday, December 16, 2009
  46. 46. Model with a ruby Hash* .+1+V+,"&4&g+,6(-": .+1+V+,"&4&^>K,"!,>&4J&^>I+?.%10H""=>&4J&^>-0IV!">&4J&>]+$!0>@&>+3"??%.0>&4J&>G0I3%?%0>&__@ &&&&&&&&&&&&&&&&&&&&&&&^>3+V?"1">&&&&&4J&^>-0IV!">&4J&>G+V?0>@&>"I+%?>&&&&4J&>3+V?"1"MHI+%?(*0I>__@ &&&&&&&&&&&&&&&&&&&&&&&^>N$!.">&&&&&&&4J&^>-0IV!">&4J&>j0!H">@&>?+-H$+H">&4J&>+,1$!%+-$>&__ &&&&&&&&&&&_@ &&&&&&&&&&&^>5+H,>&4J&^>I+?.%10H""=>&4J&^>7?0:"!>&&4J&^>[DD)D)Bk>&4J&>B[lm>@&>[DD)DC)Bk>&4J&>km[>&_@ &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&>3?+*",>&&4J&^>[DD)BB)Bk>&4J&>ln>@&&>[DD)BD)Bl>&4J&>k>&_@ &&&&&&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 &&&&&&&&&&&_@ &&&&&&&&&&&^>G6010,>&4J&^>B>&&&&4J&^>1%1?">4J>I2&7!%"-.,>@&>$!?>4J>61138)):3%*(*0I)[.6l=?.>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>[>&&&&4J&^>1%1?">4J>h-+>@&&&&&&&&>$!?>4J>61138)):3%*(*0I),.f=:!">_@ &&&&&&&&&&&&&&&&&&&&&&&&&>l>&&&&4J&^>1%1?">4J>Q+.%,?+L>@&&&>$!?>4J>61138)):3%*(*0I)H,lm.!">_@ &&&&&&&&&&&&&&&&&&&&&&&&&>k>&&&&4J&^>1%1?">4J>9+!*"?0-+>@&&>$!?>4J>61138)):3%*(*0I)2ml7.7.>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>>&&&&4J&^>1%1?">4J>]0-="2>@&&&&&>$!?>4J>61138)):3%*(*0I)7"!"!"7>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>ln>&&4J&^>1%1?">4J>W":&p0!=>@&&&>$!?>4J>61138)):3%*(*0I)f=?"!%1>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>km[>&&4J&^>1%1?">4J>q6%1"&T0,">@&>$!?>4J>61138)):3%*(*0I)=.f="f7>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>B[lm>&4J&^>1%1?">4J>9?+*=&T0,">@&>$!?>4J>61138)):3%*(*0I)[lC.HVH>_ &&&&&&&&&&&&&&&&&&&&&&&&_ &&&&&&&&&&&_ Zr%L"&I"&+-&$,"!&"I+%? 3$1,&.+1+V+,"`>K,"!,>a`>3+V?"1">a`>"I+%?>a Z4J&>3+V?"1"MHI+%?(*0I> Zr%L"&I"&16"&36010,&1+H".&>7?0:"!>&70!&$,"!&>I+?.%10H""=> 3$1,&.+1+V+,"`>5+H,>a`>I+?.%10H""=>a`>7?0:"!>a(L+?$", 3$1,&.+1+V+,"`>G6010,>a`>B[lm>a`>1%1?">a & *ordered hash, ruby 1.9 for example Wednesday, December 16, 2009
  48. 48. Model with a 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L>@&&&>$!?>4J>61138)):3%*(*0I)H,lm.!">_@ &&&&&&&&&&&&&&&&&&&&&&&&&>k>&&&&4J&^>1%1?">4J>9+!*"?0-+>@&&>$!?>4J>61138)):3%*(*0I)2ml7.7.>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>>&&&&4J&^>1%1?">4J>]0-="2>@&&&&&>$!?>4J>61138)):3%*(*0I)7"!"!"7>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>ln>&&4J&^>1%1?">4J>W":&p0!=>@&&&>$!?>4J>61138)):3%*(*0I)f=?"!%1>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>km[>&&4J&^>1%1?">4J>q6%1"&T0,">@&>$!?>4J>61138)):3%*(*0I)=.f="f7>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>B[lm>&4J&^>1%1?">4J>9?+*=&T0,">@&>$!?>4J>61138)):3%*(*0I)[lC.HVH>_ &&&&&&&&&&&&&&&&&&&&&&&&_ &&&&&&&&&&&_ Zr%L"&I"&+-&$,"!&"I+%? 3$1,&.+1+V+,"`>K,"!,>a`>3+V?"1">a`>"I+%?>a Z4J&>3+V?"1"MHI+%?(*0I> Zr%L"&I"&16"&36010,&1+H".&>7?0:"!>&70!&$,"!&>I+?.%10H""=> 3$1,&.+1+V+,"`>5+H,>a`>I+?.%10H""=>a`>7?0:"!>a(L+?$", Z4J`>B[lm>@>km[>a 3$1,&.+1+V+,"`>G6010,>a`>B[lm>a`>1%1?">a & *ordered hash, ruby 1.9 for example Wednesday, December 16, 2009
  49. 49. Model with a ruby Hash* .+1+V+,"&4&g+,6(-": .+1+V+,"&4&^>K,"!,>&4J&^>I+?.%10H""=>&4J&^>-0IV!">&4J&>]+$!0>@&>+3"??%.0>&4J&>G0I3%?%0>&__@ &&&&&&&&&&&&&&&&&&&&&&&^>3+V?"1">&&&&&4J&^>-0IV!">&4J&>G+V?0>@&>"I+%?>&&&&4J&>3+V?"1"MHI+%?(*0I>__@ &&&&&&&&&&&&&&&&&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&&&&&&&&&&&&>ln>&&4J&^>1%1?">4J>W":&p0!=>@&&&>$!?>4J>61138)):3%*(*0I)f=?"!%1>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>km[>&&4J&^>1%1?">4J>q6%1"&T0,">@&>$!?>4J>61138)):3%*(*0I)=.f="f7>_@ &&&&&&&&&&&&&&&&&&&&&&&&&>B[lm>&4J&^>1%1?">4J>9?+*=&T0,">@&>$!?>4J>61138)):3%*(*0I)[lC.HVH>_ &&&&&&&&&&&&&&&&&&&&&&&&_ &&&&&&&&&&&_ Zr%L"&I"&+-&$,"!&"I+%? 3$1,&.+1+V+,"`>K,"!,>a`>3+V?"1">a`>"I+%?>a Z4J&>3+V?"1"MHI+%?(*0I> Zr%L"&I"&16"&36010,&1+H".&>7?0:"!>&70!&$,"!&>I+?.%10H""=> 3$1,&.+1+V+,"`>5+H,>a`>I+?.%10H""=>a`>7?0:"!>a(L+?$", Z4J`>B[lm>@>km[>a 3$1,&.+1+V+,"`>G6010,>a`>B[lm>a`>1%1?">a Z4J>9?+*=&T0,"> *ordered hash, ruby 1.9 for example Wednesday, December 16, 2009
  50. 50. Thanks Pablo Delgado @pablete pablete@gmail.com Wednesday, December 16, 2009
  51. 51. References • Avinash Lakshman, Prashant Malik (Facebook) Cassandra - A Decentralized Structured Storage System http://static.last.fm/johan/nosql-20090611/cassandra_nosql.pdf • Jonathan Ellis (Rackspace Apache) Introduction to Cassandra at OSCON 09 http://assets.en.oreilly.com/1/event/27/Cassandra_%20Open%20Source %20Bigtable%20+%20Dynamo%20Presentation.pdf • Todd Lipcon. (Cloudera) Design Patterns for Distributed Non-Relational Databases http://static.last.fm/johan/nosql-20090611/intro_nosql.pdf Wednesday, December 16, 2009

×