Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SimpleDb, an introduction

6,130 views

Published on

An introduction to Amazon AWS SimpleDB, I gave this talk at the Ruby on Rails usergroup meeting of june 2009

Published in: Technology, Design
  • Hey, awesome presentation!!

    just one little thing... on slide 14, aren't you missing one '}' after 'square'?

    Thanks for sharing it!!
    Fer
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

SimpleDb, an introduction

  1. 1. Amazon SimpleDB A quick intro Paolo Negri twitter @hungryblank
  2. 2. DB
  3. 3. DB? •SimpleDB •CouchDB •MongoDB
  4. 4. DB? http://www.flickr.com/photos/zheem/3091325244/
  5. 5. Key Value store? http://www.flickr.com/photos/wdwbarber/1338954161/
  6. 6. A bit like... • BigTable • HyperTable • Redis • TokyoCabinet • ...
  7. 7. Different Shades DB > KV > http://www.flickr.com/photos/dey/11717609/
  8. 8. Commonalities Schema less N O Just store your data
  9. 9. Commonalities • No transactions • No relations • No datatypes (some)
  10. 10. 0.7 seconds to store 1 million records Fast (TokyoCabinet) http://www.flickr.com/photos/donsolo/1405885541/
  11. 11. Big datasets SimpleDB 1.000.000.000 attributes/domain * 100 domains http://www.flickr.com/photos/digitalart/2101765353/
  12. 12. Key Value A D H1 A6 
 < Key data data data data < Value 

  13. 13. SimpleDB A T W 






 
 < Key data data } Attribute > Attribute value > < Value
  14. 14. SimpleDB Nested hash of strings
  15. 15. SimpleDB • Only strings • No schema (no attribute declaration) • up to 256 attributes per item • EVERYTHING INDEXED
  16. 16. SimpleDB 






 < 
 Key Attribute > W Attribute value > • 1024 K max length 
 • Any UT8 character that is valid in XML docs can be used
  17. 17. SimpleDB • 1.000.000.000 attributes per domain • 100 domains per account • you can have more than one account
  18. 18. SimpleDB <wtf>wtf</wtf> SOAP protocol http://www.flickr.com/photos/rescuedog/2242215507
  19. 19. SimpleDB Or “REST” http://sdb.amazonaws.com/? AWSAccessKeyId=BLAHBLAH&Action=PutAttributes&Attribute. 0.Name=code&Attribute. 0.Value=31&DomainName=test_domain&ItemName=bar41&Sign atureMethod=HmacSHA256&SignatureVersion=2&Timestamp=20 09-06-07T23%3A15%3A50Z&Version=2007-11-07&Signature=...
  20. 20. SimpleDB request REST or XML SimpleDB Host response XML
  21. 21. SimpleDB Requests • create/delete domain • put/get/delete (selectively) attributes • and... SELECT
  22. 22. SimpleDB Domain: a container of (nested) key value • Up to 10GB big • Up to 1.000.000.000 attributes stored
  23. 23. SimpleDB - PUT
  24. 24. SimpleDB - GET you pay bandwidth :)
  25. 25. Oh yes, $$ • first GB data IN free, 0.10$ after • first GB data OUT free, 0.17$ or less after • first GB stored is free, 0.25GB/month after
  26. 26. So, PUT again + =
  27. 27. Attribute values are always arrays 






 
 < Key } Attribute > < Value Array Attribute value > Even if there’s only one value!!
  28. 28. Select • Sort • Multiple conditions • Understands only strings! • So you need to think when you store your data
  29. 29. Gems • hungryblank-aws_sdb_bare (github) very low level one to one mapping with SimpleDB calls • right_aws high level, active recordish api and an hash api • aws-sdb not any more mantained but still working
  30. 30. SimpleDB - Cons • Eventual Consistency - Data is not immediately propagated across all nodes… the latency is usually around a second • Latency specially if you’re not on ec2 • Protocol - if compared with json stores • Only strings, lexicographical string only
  31. 31. SimpleDB - Pros • Is basically free to try out • Everything is indexed • Distributed • Replicated • Completely hosted on Amazon system
  32. 32. Q? Paolo Negri twitter @hungryblank

×