Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scale without NoSQL

Justin Mann
September 07, 2013

Scale without NoSQL

NoSQL is cool, trendy, powerful and can easily create some truly terrible problems when you actually try to scale it. It is often seen as the easy solution for building a production environment that scale to the size of Facebook. I will breakdown the reasons why people look toward NoSQL as their savior and the reasons you might want to re-consider this decision. The truth is that NoSQL like many new technologies has certain advantages and corresponding negatives.

Justin Mann

September 07, 2013
Tweet

Other Decks in Programming

Transcript

  1. 2 Bubbly – an Audio Version of Twitter !  

    New viral voice communication platform !   Embraces industry shifts toward: !  Social networking !  Group messaging !  Community building !  User generated content !  Bringing social media to audio !   Explosive traffic growth & revenue potential
  2. 3 Silicon Valley veterans with engineers from around the world

    Bubbly Overview Overview 30M+ users just over two years since launch of Bubbly Leading mobile social media & messaging service across Asia Sequoia Capital, JAFCO, SingTel & Comcast Singapore (HQ) + Mumbai, Manila, Jakarta, Tokyo, Saigon & Bangkok •  Tony Bates, CEO Skype •  Dave Williams, former CTO O2, AT&T, and Telefonica •  Jimmy Iovine, Chairman, Interscope Records (Judge on American Idol) •  Gaurav Garg, Sequoia Capital US •  Nikki Han, President, SM Entertainment (Korea) •  Mohit Bhatnagar, Sequoia India Overview   Offices Investors Users Team Board / Advisors
  3. 5 Problem Definition !   30+ million users !  

    Social graph !   1:Many communication – Twitter !   1:1 communication – IM (What’s App)
  4. 6 No NoSQL ?? !   Actually, we do use

    NoSQL but we don’t trust it ! Redis !  Great as a read cache !  Do not trust ability to scale !  Can be deleted without no downtime
  5. 7 NoSQL Cheat Sheet NoSQL   SQL   ACID  

    Drops  ACID   Definitely  loves  ACID   Horizontal  scaling   Magic   Custom   Data  store   Key/Value   RDMS   Changing  schema   No  schema   ALTER  TABLE   AWS  setup   Varies/DynamoDB   RDS  
  6. 8 Horizontal Scaling ! NoSQL selling point is that adding

    a new server is easy !   Not always easy: !  Foursquare http://www.infoq.com/news/ 2010/10/4square_mongodb_outage !   SQL scaling requires planning !  Can you move tables to a new DB? !  Can you divide your table across multiple DBs? !  Will you divide your data by time, random id, etc?
  7. 9 ALTER TABLE !   This will make you hate

    SQL !   Downtime or … !  CREATE TABLE new_schema !  Script to move from old_schema to new_schema !  Modify code to use new_schema, with a backup to old_schema !  Re-run script !  DROP TABLE old_schema
  8. 10 Key/Value vs. RDMS !   Similar to Javascript vs.

    Java !   Key/Value is very fast to implement and difficult to change !   RDMS is slow to implement and much harder to change
  9. 11 Schema-less SQL ! http://backchannel.org/blog/friendfeed-schemaless- mysql !   One table

    per indexed key !   One master table indexed by uuid with data as blob !   Updating value that is indexed is either risky or complex: !  BEGIN TRANSACTION !  UPDATE user_blobs SET blob=[] WHERE id=1234 !  UPDATE user_indexed_key SET key=[] WHERE id=1234 !  COMMIT TRANSACTION
  10. 12 SQL Sharding ! http://www.percona.com/live/mysql-conference-2012/ sessions/scaling-pinterest !   Database IDs

    combine shard ID & local ID !   [Shard 1]_[UUID] !   Foreign key constraint will not work !   JOIN is complicated