0
NoSQL Solutions  Byeongweon Moon   tasyblue@gmail.com     2012.01.26
Redis, Couchbase, MongoDB, Membase
Memory Base Cache vs.       Database
NoSQL• Collections (versus tables)• Documents (versus rows)• Loosely defined fields (versus  columns)• Scale out (versus s...
Data Model•   Relational•   Key-value•   Column-oriented•   Document-oriented
Relational
Key-value
Column-oriented
Document-oriented    FirstName="Jonathan",    Address="15 Wanamassa Point    Road",K   Children=[E        {Name:"Michael",...
Memory Base Cache•   Weak Persistence•   Weak Consistency•   Strong Performance•   Low Latency
Membase• Based on Memcached• Written by C++(Memcached),  Erlang(Membase)• Distributed, in-memory key-value  database manag...
Membase (cont’)• Persistence  – Asynchronously writes data to disk after    acknowledging write to client  – Guarantees da...
Redis• In-memory, key-value data store• Written by ANSI C, support various  client
Redis (cont’)• Various Data Models  – List, Set, Sorted Set, Hash  – Support atomic operation about data types• Persistenc...
Membase vs. Redis         Membase               RedisString                 Set, List, Sorted List,                       ...
How to use…• Normally use …$key = md5(SELECT * FROM rest_of_sql_statement_goes_here);if ($memcache->get($key)) { return $m...
How to use … (cont’)• Structured Data (array, struct…)  – Serialize       KEY                     VALUE  user:$user_id    ...
Application Design using            Membase• Cache result other than SQL data!• Use a cache hierarchy• Update membase as y...
Database•   Persistence•   Reliable•   Scalable•   Distributed•   Clustered
MongoDB•   Document-oriented Storage•   High Write Performance•   Full index support•   Master/Slave Replication•   Suppor...
CouchDB• Document-oriented Storage• High Read Performance• ACID Semantics• Map/Reduce View and Indexes• Distributed Archit...
CASE STUDY
Twitter
Facebook Timeline
APPENDIX
CouchDB              MongoDB            MySQL              Document-Oriented (JS Document-OrientedData Model              ...
Map/reduce of ja                    vascript functio Dynamic; object-Query Method        ns to lazily bui based query lang...
References•   NoSQL solutions: Membase, Redis, CouchDB and MongoDB :    http://blog.fedecarg.com/2011/01/25/nosql-solution...
No sql solutions - 공개용
No sql solutions - 공개용
Upcoming SlideShare
Loading in...5
×

No sql solutions - 공개용

581

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
581
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "No sql solutions - 공개용"

  1. 1. NoSQL Solutions Byeongweon Moon tasyblue@gmail.com 2012.01.26
  2. 2. Redis, Couchbase, MongoDB, Membase
  3. 3. Memory Base Cache vs. Database
  4. 4. NoSQL• Collections (versus tables)• Documents (versus rows)• Loosely defined fields (versus columns)• Scale out (versus scale up)• Denormalization (versus normalization)
  5. 5. Data Model• Relational• Key-value• Column-oriented• Document-oriented
  6. 6. Relational
  7. 7. Key-value
  8. 8. Column-oriented
  9. 9. Document-oriented FirstName="Jonathan", Address="15 Wanamassa Point Road",K Children=[E {Name:"Michael",Age:10},Y {Name:"Jennifer", Age:8}, {Name:"Samantha", Age:5}, {Name:"Elena", Age:2} ]
  10. 10. Memory Base Cache• Weak Persistence• Weak Consistency• Strong Performance• Low Latency
  11. 11. Membase• Based on Memcached• Written by C++(Memcached), Erlang(Membase)• Distributed, in-memory key-value database management system• Optimized for storing data behind web applications
  12. 12. Membase (cont’)• Persistence – Asynchronously writes data to disk after acknowledging write to client – Guarantees data consistency• Replication and failover (server failures recoverable in under 100ms)• Scalability and performance – Distributed object store – Dynamic cluster resizing and rebalancing – Guaranteed data consistency – High sustained throughput – Low, predictable latency
  13. 13. Redis• In-memory, key-value data store• Written by ANSI C, support various client
  14. 14. Redis (cont’)• Various Data Models – List, Set, Sorted Set, Hash – Support atomic operation about data types• Persistence – Data is held in memory but written to disk asynchronously• Replication – Master-Slave replication• Performance – Non-blocking I/O. Single threaded• Publish/Subscribe
  15. 15. Membase vs. Redis Membase RedisString Set, List, Sorted List, Hash..Master-Master Master-SlaveStoring, inc/dec API Various operations includes pop, push, extract …Web management UI Console management tool
  16. 16. How to use…• Normally use …$key = md5(SELECT * FROM rest_of_sql_statement_goes_here);if ($memcache->get($key)) { return $memcache->get($key);}else { $result = $query_results_mangled_into_most_likely_an_array $memcache->set($key, $result, TRUE, 86400); return $result;}
  17. 17. How to use … (cont’)• Structured Data (array, struct…) – Serialize KEY VALUE user:$user_id name:문병원|call:하겐다즈|… – Normalization KEY VALUE user:$user_id:name 문병원 user:$user_id:call 하겐다즈
  18. 18. Application Design using Membase• Cache result other than SQL data!• Use a cache hierarchy• Update membase as your data updates• Race conditions and stale data• Pre warm your cache• Storing lists with keys• Batch your requests with get_multi From memcached FAQ
  19. 19. Database• Persistence• Reliable• Scalable• Distributed• Clustered
  20. 20. MongoDB• Document-oriented Storage• High Write Performance• Full index support• Master/Slave Replication• Support Map/Reduce• Auto-Sharding• Querying• GridFS• Written in C++
  21. 21. CouchDB• Document-oriented Storage• High Read Performance• ACID Semantics• Map/Reduce View and Indexes• Distributed Architecture with Replication• REST API• Eventual Consistency• Written in Erlang
  22. 22. CASE STUDY
  23. 23. Twitter
  24. 24. Facebook Timeline
  25. 25. APPENDIX
  26. 26. CouchDB MongoDB MySQL Document-Oriented (JS Document-OrientedData Model Relational ON) (BSON) string, int, doubl string, number, boole e, boolean, date, Various Types LData Types an, array, object byte array, object ink , array, othersLarge Object Yes (attachments) Yes (GridFS) BlobZs (Files)Horizontal partitioning CouchDB Lounge Auto-sharding Partitioningscheme Master-slave, m Master-master (with d Master-slave and r ulti-master, anReplication eveloper supplied con eplica sets d circular repl flict resolution) icationObject(row) One large repository Collection-based Table-basedStorage
  27. 27. Map/reduce of ja vascript functio Dynamic; object-Query Method ns to lazily bui based query lang Dynamic; SQL ld an index per uage querySecondary Indexes Yes Yes YesAtomicity Single document Single document Yes - advanced Native drivers ;Interface REST Native drivers REST add-on Map/Reduce, servServer-side batch d Map/Reduce er-side javascri Yes (SQL)ata manipulation ptWritten in Erlang C++ C++ Eventually consi Strong consisten Strong consiste stent (master-ma cy. Eventually ncy. EventuallDistributed Consist ster replication consistent reads y consistent reency Model with versioning from secondaries ads from second and version reco are available. aries are avail nciliation) able.
  28. 28. References• NoSQL solutions: Membase, Redis, CouchDB and MongoDB : http://blog.fedecarg.com/2011/01/25/nosql-solutions-membase-redis- couchdb-and-mongodb/• Visual Guide to NoSQL Systems : http://blog.nahurst.com/visual-guide-to- nosql-systems• MongoDB, CouchDB, MySQL Compare Grid : http://www.mongodb.org/display/DOCS/MongoDB,+CouchDB,+MySQL+Compare+Grid• SQL to Mongo Mapping Chart : http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart• Memcached FAQ : http://code.google.com/p/memcached/wiki/FAQ#Simple_query_result_caching• Couchbase 2.0 Manual : http://docs.couchbase.org/couchbase-manual-2.0.pdf• Building Timeline : Facebook http://www.facebook.com/notes/facebook- engineering/building-timeline-scaling-up-to-hold-your-life- story/10150468255628920
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×