Sharding and More    weng.wei@zalora.sg
• Sharding is about scaling• scaling up VS scaling out
Scaling Out• Add more nodes• Each node shared nothing
Key / Value• server = serverlist[ hash(key) %  len(serverlist) ]
Relational DB• On Primary Key• On Index
Middle layer• MySQL Proxy
Client Side• Memcached client• ORM
Limitation• No joining • Join on the same shard is OK• Data maintenance
Pre-Sharding• Move database is easier than move data
Problem of sharding• serverlist[ hash(key) % len(serverlist)
Consistent Hash• ketama from last.fm • De facto Standard for memcached
Do we use sharding?• Memcached Client• MySQL for different ventures
SQL vs NoSQL• NoSQL is “Not Only SQL”• NoSQL completes SQL, but not replaces it
NoSQL is about• Performance?• Scaling (easier to shard)?• Flexibility (schema-less)?
Performance• Memcacahed is faster than MySQL?• SQL faster than K/V?• Memory faster than disk?
MySQL for K/V• handler socket
Schema - less• Friendfeed’s solution • Table as secondary index, then shard
• No silver bullet• Trade off
Upcoming SlideShare
Loading in...5
×

Sharding

555

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

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

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "Sharding"

    1. 1. Sharding and More weng.wei@zalora.sg
    2. 2. • Sharding is about scaling• scaling up VS scaling out
    3. 3. Scaling Out• Add more nodes• Each node shared nothing
    4. 4. Key / Value• server = serverlist[ hash(key) % len(serverlist) ]
    5. 5. Relational DB• On Primary Key• On Index
    6. 6. Middle layer• MySQL Proxy
    7. 7. Client Side• Memcached client• ORM
    8. 8. Limitation• No joining • Join on the same shard is OK• Data maintenance
    9. 9. Pre-Sharding• Move database is easier than move data
    10. 10. Problem of sharding• serverlist[ hash(key) % len(serverlist)
    11. 11. Consistent Hash• ketama from last.fm • De facto Standard for memcached
    12. 12. Do we use sharding?• Memcached Client• MySQL for different ventures
    13. 13. SQL vs NoSQL• NoSQL is “Not Only SQL”• NoSQL completes SQL, but not replaces it
    14. 14. NoSQL is about• Performance?• Scaling (easier to shard)?• Flexibility (schema-less)?
    15. 15. Performance• Memcacahed is faster than MySQL?• SQL faster than K/V?• Memory faster than disk?
    16. 16. MySQL for K/V• handler socket
    17. 17. Schema - less• Friendfeed’s solution • Table as secondary index, then shard
    18. 18. • No silver bullet• Trade off
    1. A particular slide catching your eye?

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

    ×