Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Picking the right API for the right job – Couchbase Connect 2016

245 views

Published on

From the ancient Greeks to the modern geeks, it is known that the whole is greater than the sum of its parts – and with Couchbase it is no different. Even though Couchbase provides powerful individual features that you can enable and deploy as you see fit (Key/Value, Views, N1QL, and FTS), combining them allows you to unleash their full potential. In this session you will learn how the individual services are exposed in the SDKs through a consistent and flexible API and how it assists you with using more of them at the same time. By using clever techniques you will be able to increase the performance of your queries as well as reduce index sizes and keep your application responsive under load.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Picking the right API for the right job – Couchbase Connect 2016

  1. 1. ©2016 Couchbase Inc. Picking the right API for the right Job 1
  2. 2. ©2016 Couchbase Inc. 2 Michael Nitschinger Senior Software Engineer, SDKs michael.nitschinger@couchbase.com daschl IMAGE GOES HERE
  3. 3. ©2016 Couchbase Inc. 3 Michael Nitschinger Senior Software Engineer, SDKs michael.nitschinger@couchbase.com daschl http://www.wienerwald.at/wp-content/uploads/2016/01/schnitzel_pommes.jpg
  4. 4. ©2016 Couchbase Inc. 4 Michael Nitschinger Senior Software Engineer, SDKs michael.nitschinger@couchbase.com daschl http://www.wienerwald.at/wp-content/uploads/2016/01/schnitzel_pommes.jpg
  5. 5. ©2016 Couchbase Inc. 5 One SDK API to rule them all
  6. 6. ©2016 Couchbase Inc. 6 One SDK API to rule them all http://vignette3.wikia.nocookie.net/lotr/images/e/e1/Gollum_Render.png/revision/20141216091433
  7. 7. ©2016 Couchbase Inc.©2016 Couchbase Inc. Services STORAGE Couchbase Server 1 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster ManagerCluster Manager Data Service STORAGE Couchbase Server 2 Managed Cache Cluster ManagerCluster Manager Data Service STORAGE Couchbase Server 3 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster ManagerCluster Manager Data Service STORAGE Couchbase Server 4 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster ManagerCluster Manager Index Service STORAGE Couchbase Server 5 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster ManagerCluster Manager STORAGE Couchbase Server 6 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster ManagerCluster Manager Query Service FTS Service Index Service
  8. 8. ©2016 Couchbase Inc.©2016 Couchbase Inc. Services Data Views N1QL FTS Analytics
  9. 9. ©2016 Couchbase Inc.©2016 Couchbase Inc. Services Data Binary 11210 Views JSON 8092 N1QL JSON 8093 FTS JSON 8094 Analytics JSON 8095
  10. 10. ©2016 Couchbase Inc.©2016 Couchbase Inc. Balance 10https://upload.wikimedia.org/wikipedia/commons/b/b7/Unico_Anello.png Language Specifics Uniformity across SDKs
  11. 11. ©2016 Couchbase Inc.©2016 Couchbase Inc. Balance 11https://upload.wikimedia.org/wikipedia/commons/b/b7/Unico_Anello.png
  12. 12. ©2016 Couchbase Inc.©2016 Couchbase Inc. Balance 12https://upload.wikimedia.org/wikipedia/commons/b/b7/Unico_Anello.png
  13. 13. ©2016 Couchbase Inc.©2016 Couchbase Inc. Balance 13https://upload.wikimedia.org/wikipedia/commons/b/b7/Unico_Anello.png
  14. 14. ©2016 Couchbase Inc.©2016 Couchbase Inc. Balance 14https://upload.wikimedia.org/wikipedia/commons/b/b7/Unico_Anello.png
  15. 15. ©2016 Couchbase Inc.©2016 Couchbase Inc. RFCs • Semi-Formal process to advance SDKs in both API and behavior • One Shepherd • Collaborative consensus (hard!) compromises • Public: https://github.com/couchbaselabs/sdk-rfcs 15
  16. 16. ©2016 Couchbase Inc.©2016 Couchbase Inc. Prioritizing Uniformity • Program Flow 16
  17. 17. ©2016 Couchbase Inc.©2016 Couchbase Inc. Prioritizing Uniformity 17
  18. 18. ©2016 Couchbase Inc.©2016 Couchbase Inc. Prioritizing Language Specifics 18
  19. 19. ©2016 Couchbase Inc. 19 Navigating the API Landscape
  20. 20. ©2016 Couchbase Inc.©2016 Couchbase Inc. Key/Value • Fastest way to access & mutate documents • Access by Document ID only • Includes subdocument manipulation • Efficient binary protocol 20 Latency Flexibility
  21. 21. ©2016 Couchbase Inc.©2016 Couchbase Inc. Key/Value – Full Doc Access 21
  22. 22. ©2016 Couchbase Inc.©2016 Couchbase Inc. Key/Value – Full Doc Access 22
  23. 23. ©2016 Couchbase Inc.©2016 Couchbase Inc. Key/Value – Sub Doc Access 23
  24. 24. ©2016 Couchbase Inc.©2016 Couchbase Inc. Views • Distributed Map-Reduce • Great for Aggregations (fast) • Spatial Support 24 Latency Flexibility
  25. 25. ©2016 Couchbase Inc.©2016 Couchbase Inc. Views 25
  26. 26. ©2016 Couchbase Inc.©2016 Couchbase Inc. N1QL • Very flexible, but get your index right • Global Index instead of Map/Reduce • Similar to SQL 26 Latency Flexibility
  27. 27. ©2016 Couchbase Inc.©2016 Couchbase Inc. N1QL 27
  28. 28. ©2016 Couchbase Inc.©2016 Couchbase Inc. FullText Search • Very Flexible, but more concepts to learn initially • Inverted Index • Still Developer Preview • Similar to Elasticsearch 28 Latency Flexibility
  29. 29. ©2016 Couchbase Inc.©2016 Couchbase Inc. FullText Search 29
  30. 30. ©2016 Couchbase Inc.©2016 Couchbase Inc. Analytics • Highly capable analytical storage engine • Similar to N1QL for querying • Performs great on huge datasets and aggregations • Developer Preview announced at Connect! 30 Latency Flexibility
  31. 31. ©2016 Couchbase Inc.©2016 Couchbase Inc. Streaming/Changes Feed • Based on the DCP protocol • Very fast and efficient • Low level -> Building Block 31 Latency Flexibility
  32. 32. ©2016 Couchbase Inc.©2016 Couchbase Inc. Michael’s Super Sophisticated Flowchart to Success 32 Know the Doc ID(s)? SuccessUse KV Pre Grouped Aggregations? Use Views Need Full Text Queries? Use FTS Use N1QL
  33. 33. ©2016 Couchbase Inc.©2016 Couchbase Inc. Michael’s Super Sophisticated Flowchart to Success 33 Know the Doc ID(s)? SuccessUse KV Pre Grouped Aggregations? Use Views Need Full Text Queries? Use FTS Use N1QL
  34. 34. ©2016 Couchbase Inc.©2016 Couchbase Inc. Michael’s Super Sophisticated Flowchart to Success 34 Know the Doc ID(s)? SuccessUse KV Pre Grouped Aggregations? Use Views Need Full Text Queries? Use FTS Use N1QL
  35. 35. ©2016 Couchbase Inc.©2016 Couchbase Inc. Michael’s Super Sophisticated Flowchart to Success 35 Know the Doc ID(s)? SuccessKV Pre Grouped Aggregations? Views Need Full Text Queries? FTS N1QL
  36. 36. ©2016 Couchbase Inc. 36 (Not So) DirtyTricks for Fun and Profit
  37. 37. ©2016 Couchbase Inc.©2016 Couchbase Inc. The “Cache It While Its Hot” • Transparently cache expensive N1QL/FTS/View results with aTTL and load while hot 37
  38. 38. ©2016 Couchbase Inc.©2016 Couchbase Inc. The “Cache It While Its Hot” • Transparently cache expensive N1QL/FTS/View results with aTTL and load while hot 38
  39. 39. ©2016 Couchbase Inc.©2016 Couchbase Inc. The “Custom Bulk Loader” • Perform a N1QL, FTS orView query to just fetch the doc IDs, then perform a bulk KV fetch 39
  40. 40. ©2016 Couchbase Inc.©2016 Couchbase Inc. The “Custom Bulk Loader” • Perform a N1QL, FTS orView query to just fetch the doc IDs, then perform a bulk KV fetch 40
  41. 41. ©2016 Couchbase Inc.©2016 Couchbase Inc. The “Tarzan of the Docs” • “Leap” from Doc to Doc via references and use bulk fetches for higher throughput • Scales with increasing batch size • Allows to “code” intermediate steps with UDFs 41
  42. 42. ©2016 Couchbase Inc.©2016 Couchbase Inc. Summary 42 Tradeoff Latency vs. Flexibility Remember Powerful Patterns Unsure? Think of the Flowchart Participate in the RFCs!
  43. 43. ©2016 Couchbase Inc. ThankYou! 43

×