RDBMS to NoSQL for Developers

976 views

Published on

Developers have grown comfortable with relational databases and programming with SQL. But there are new data challenges and application opportunities that may be better served with next-generation NoSQL databases. In this webinar you’ll learn about making the transition to NoSQL and discuss best practices for: developing with flexible schemas, managing concurrency in a world without transactions, querying a NoSQL database and rolling out index upgrades without impacting application availability.

Published in: Business, Technology
1 Comment
4 Likes
Statistics
Notes
  • great help...:)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
976
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide

RDBMS to NoSQL for Developers

  1. 1. NoSQLforDevelopers: Migra5ngfromRDBMS Chris&Anderson ChiefArchitect,Mobile @jchris 1Thursday, July 12, 12
  2. 2. NoSQL"Webinar"Series" NoSQL&for&Architects:&Migra4ng&from&RDBMS&to&a& schema:less&world& " NoSQL&for&Developers:&Migra4ng&from&RDBMS&to&a& schema:less&world& & NoSQL&for&DBAs:&Migra4ng&from&RDBMS&to&a& schema:less&world& & " 1"
  3. 3. WHY&NOSQL? 2Thursday, July 12, 12
  4. 4. Modern interactive software architecture Application Scales Out Just add more commodity web servers Database Scales Up Get a bigger, more complex server Note–Rela5onaldatabasetechnologyisgreatforwhatitisgreatfor,butitisnotgreatforthis. 3Thursday, July 12, 12
  5. 5. NoSQL database matches application logic tier architecture Data layer scales with linear cost and constant performance. Application Scales Out Just add more commodity web servers NoSQLDatabaseServers Database Scales Out Just add more commodity data servers Scaling out flattens the cost and performance 4 curves.Thursday, July 12, 12
  6. 6. DrawSomethingbyOMGPOP 5Thursday, July 12, 12
  7. 7. DrawSomething“goesviral”3weeksaTerlaunch Draw&Something&by&OMGPOP Daily&Ac)ve&Users&(millions) 16 14 12 10 8 6 4 2 2/6 8 10 12 14 16 18 20 22 24 26 28 3/1 3 5 7 9 11 13 15 17 19 21 6Thursday, July 12, 12
  8. 8. Asusagegrew,gamedatawentnonZlinear. Draw&Something&by&OMGPOP Daily&Ac)ve&Users&(millions) 16 14 12 10 8 ByMarch19,therewere 6 over30,000,000&downloadsoftheapp, over5,000&drawingsbeingstoredper&second, 4 over2,200,000,000&drawingsstored, over105,000databasetransacIons&per&second, 2 andover3.3&terabytesofdatastored. 2/6 8 10 12 14 16 18 20 22 24 26 28 3/1 3 5 7 9 11 13 15 17 19 21 7Thursday, July 12, 12
  9. 9. Incontrast. The&Simpson’s:&Tapped&Out Daily&Ac)ve&Users&(millions) 16 14 12 10 8 6 4 #2&FreeapponiPad 2 #3&FreeapponiPhone 2/6 8 10 12 14 16 18 20 22 24 26 28 3/1 3 5 7 9 11 13 15 17 19 21 8Thursday, July 12, 12
  10. 10. WHY&NOSQL? SCALE 9Thursday, July 12, 12
  11. 11. WHY&NOSQL? FLEXIBILITY 10Thursday, July 12, 12
  12. 12. Developersaremovingawayfromrigidschemas 11Thursday, July 12, 12
  13. 13. NormalizedSchemasZDevelopmentComplexity 12Thursday, July 12, 12
  14. 14. YoumightwantNoSQLif... • Tableswithlotsofcolumns • TableswithlotsofNULLs • En5tyAcributeValuepacern • Messydomainmodels/overZmodeling • Tablesundergoinglotsofschemachanges • Subsystemsthatneedtoscaleindependently • YouarelivinginaJSONworld • Youneedtomeet5meZbasedSLAs • Largetablesareslowingdownyourqueries • YouaredoingJOINsinyourapplica5oncodealready 13Thursday, July 12, 12
  15. 15. WORKING&WITH&DOCUMENTS 14Thursday, July 12, 12
  16. 16. TribalCrossing:Represen5ngGameDatainJSON Use&case&X&simple&version&of&farming&part: •Aplayercanhaveavarietyofplantsontheirfarm. •Aplayercanaddorremoveplantsfromtheirfarm. •APlayercanseewhatplantsareonanotherplayersfarm. 15Thursday, July 12, 12
  17. 17. TribalCrossing:Represen5ngGameDatainJSON Player&Object Key: Player1 Plant&Object JSON Key: Plant201 { “_id” : “Player1”, JSON “nid” : 1, { “name” : “Shawn” “_id” : “Plant201”, } “nid” : 201, “player_id” : 1 PlayerPlant&List } “name” : “Starflower” Key: Player1_PlantList JSON { “_id” : “Player1_Plantlist”, “plants” : [201, 202, 204] } 16Thursday, July 12, 12
  18. 18. TribalCrossing:DatawithoutSchemas • Noneedto“ALTERTABLE” • Addnew“fields”allobjectsatany5me • Specifydefaultvaluesformissingfields • Increaseddevelopmentspeed • Eliminatepainofmigra5ons • UsingJSONfordataobjects – Offerstheabilitytoqueryandanalyzearbitraryfieldsin Couchbase2.0 – YoucandoalotwithabasickeyvalueAPI. – Itgetsevenmoreexci5ngonceyouaddincrementalindexing 17Thursday, July 12, 12
  19. 19. TribalCrossing:ModifyingDatawithget()andset() Give&a&player&a&new&plant // Create the new plant Plant givenPlant = new Plant(100, "Mushroom"); cbclient.set("Plant100", givenPlant); // Update the player plant list Player thePlayer = player.fetch(cbclient.get("Player1")); // Add the plant to the player thePlayer.receivePlant(givenPlant); // Store the players new plant list cbclient.set("Player1_PlantList", thePlayer.getPlantsArray()); 18Thursday, July 12, 12
  20. 20. MANAGING&CONCURRENCY& WITHOUT&TRANSACTIONS 19Thursday, July 12, 12
  21. 21. NoSQL:AvailabilityoverComplexTransac5ons APP&SERVER&1 APP&SERVER&2 ! Docsdistributedevenlyacross serversinthecluster COUCHBASECLIENTLIBRARY CLUSTERMAP COUCHBASECLIENTLIBRARY CLUSTERMAP ! Eachserverstoresbothac#ve& replicadocs ! Onlyoneserverac5veata5me ! Clientlibraryprovidesappwith Read/Write/Update Read/Write/Update simpleinterfacetodatabase ! Clustermapprovidesmapto whichserverdocison ! Appneverneedstoknow SERVER&1 SERVER&2 SERVER&3 ! Appreads,writes,updatesdocs Ac5veDocs Ac5veDocs Ac5veDocs Doc5 DOC Doc4 DOC Doc1 DOC ! Mul5pleAppServerscanaccess samedocumentatsame5me Doc2 DOC Doc7 DOC Doc3 DOC Doc9 DOC Doc8 DOC Doc6 DOC ReplicaDocs ReplicaDocs ReplicaDocs Doc4 DOC Doc6 DOC Doc7 DOC Doc1 DOC Doc3 DOC Doc9 DOC Doc8 DOC Doc2 DOC Doc5 DOC COUCHBASE&SERVER&&CLUSTERUserConfiguredReplicaCount=1 20Thursday, July 12, 12
  22. 22. TribalCrossing:Concurrency • Concurrencyissuecanoccurwhenmul5ple requestsareworkingwiththesamepieceofdata. SoluIons: • CAS(checkZandZset) • Clientcanknowifsomeoneelsehas modifiedthedatawhileyouaretryingtoupdate • Providesop5mis5cconcurrencycontrol • GETL(getwithlock) • Locking(try/waitcycle) • Providespessimis5cconcurrencycontrol 21Thursday, July 12, 12
  23. 23. NoSQLthinksconcurrencyisyummy • Bulkloading – usemul5plethreads/processes/servers • UsetheCouchbaseSmartClients – subscribedtotheclustermapforsharedZnothingscalability 22Thursday, July 12, 12
  24. 24. NOSQL&QUERY&ARCHITECTURES 23Thursday, July 12, 12
  25. 25. TaxonomyofQueryModels • SecondaryIndexes – ALTERTABLEADDINDEX – IncrementalMapReduce – db.things.ensureIndex({"address.city":1}) • Fulltablescans – HadoopMapReduce – Rela5onaldatabaseifthequeryplanneroutsmartsyou • FullTextSearch – SOLR,Elas5cSearch,independentindexing5er – Driverstokeepsearchindexuptodate 24Thursday, July 12, 12
  26. 26. IncrementalMapReduceIndexing• BasicKeyandRange Lookups• Normalizedata duringindexing• DynamicAggregates• EventLoggingPacern 25Thursday, July 12, 12
  27. 27. MISSION&CRITICAL&WORKLOADS 26Thursday, July 12, 12
  28. 28. Opera5onalvisibility 27Thursday, July 12, 12
  29. 29. TrustedinProduc5on 28Thursday, July 12, 12
  30. 30. QUESTIONS? @JCHRIS HTTP://WWW.COUCHBASE.COM 29Thursday, July 12, 12

×