simpledb, an introduction
DESCRIPTION
An introduction to Amazon AWS SimpleDB, I gave this talk at the Ruby on Rails usergroup meeting of june 2009TRANSCRIPT
![Page 1: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/1.jpg)
Amazon SimpleDBA quick intro
Paolo Negritwitter @hungryblank
![Page 2: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/2.jpg)
DB
![Page 3: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/3.jpg)
DB?
•SimpleDB
•CouchDB
•MongoDB
![Page 4: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/4.jpg)
DB?
http://www.flickr.com/photos/zheem/3091325244/
![Page 5: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/5.jpg)
Key Value store?
http://www.flickr.com/photos/wdwbarber/1338954161/
![Page 6: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/6.jpg)
A bit like...
• BigTable
• HyperTable
• Redis
• TokyoCabinet
• ...
![Page 7: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/7.jpg)
Different Shades
DB >
KV > http://www.flickr.com/photos/dey/11717609/
![Page 8: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/8.jpg)
CommonalitiesSchema less
NOJust store your data
![Page 9: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/9.jpg)
Commonalities
•No transactions
•No relations
•No datatypes (some)
![Page 10: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/10.jpg)
Fast0.7 seconds to store 1 million records
http://www.flickr.com/photos/donsolo/1405885541/
(TokyoCabinet)
![Page 11: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/11.jpg)
Big datasets
SimpleDB 1.000.000.000attributes/domain * 100 domains
http://www.flickr.com/photos/digitalart/2101765353/
![Page 12: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/12.jpg)
Key ValueA
data
D
data
H1
data
A6
data
< Key
< Value
![Page 13: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/13.jpg)
SimpleDB
< Key
< Value
Attribute >
}Attribute value >
AT W
data
data
![Page 14: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/14.jpg)
SimpleDB
Nested hash of strings
![Page 15: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/15.jpg)
SimpleDB
• Only strings
• No schema (no attribute declaration)
• up to 256 attributes per item
• EVERYTHING INDEXED
![Page 16: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/16.jpg)
SimpleDB
• 1024 K max length
• Any UT8 character that is valid in XML docs can be used
< Key
WAttribute >
Attribute value >
![Page 17: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/17.jpg)
SimpleDB
• 1.000.000.000 attributes per domain
• 100 domains per account
• you can have more than one account
![Page 18: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/18.jpg)
SimpleDB
SOAP protocol<wtf>wtf</wtf>
http://www.flickr.com/photos/rescuedog/2242215507
![Page 19: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/19.jpg)
SimpleDBOr “REST”
http://sdb.amazonaws.com/?AWSAccessKeyId=BLAHBLAH&Action=PutAttributes&Attribute.
0.Name=code&Attribute.0.Value=31&DomainName=test_domain&ItemName=bar41&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-06-07T23%3A15%3A50Z&Version=2007-11-07&Signature=...
![Page 20: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/20.jpg)
SimpleDB
HostSimpleDB
requestREST or XML
responseXML
![Page 21: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/21.jpg)
SimpleDB Requests
• create/delete domain
• put/get/delete (selectively) attributes
• and... SELECT
![Page 22: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/22.jpg)
SimpleDB
• Up to 10GB big
• Up to 1.000.000.000 attributes stored
Domain: a container of (nested) key value
![Page 23: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/23.jpg)
SimpleDB - PUT
![Page 24: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/24.jpg)
SimpleDB - GET
you pay bandwidth :)
![Page 25: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/25.jpg)
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
![Page 26: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/26.jpg)
So, PUT again
+
=
![Page 27: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/27.jpg)
Attribute values are always arrays
< Key
< Value
Attribute >
}Attribute value >
Array
Even if there’s only one value!!
![Page 28: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/28.jpg)
Select
• Sort
• Multiple conditions
• Understands only strings!
• So you need to think when you store your data
![Page 29: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/29.jpg)
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
![Page 30: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/30.jpg)
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
![Page 31: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/31.jpg)
SimpleDB - Pros
• Is basically free to try out
• Everything is indexed
• Distributed
• Replicated
• Completely hosted on Amazon system
![Page 32: SimpleDb, an introduction](https://reader034.vdocument.in/reader034/viewer/2022051514/54b75eb34a795945508b456e/html5/thumbnails/32.jpg)
Q?
Paolo Negritwitter @hungryblank