Couchbase training advanced

Embed Size (px)

Citation preview

  1. 1. Deep Dive intoDeep Dive into Shivansh Srivastava Software Consultant Knoldus Software LLP Shivansh Srivastava Software Consultant Knoldus Software LLP
  2. 2. AgendaAgenda Using Views And Indexes. Couchbase 4.0 Beta Main Features Of Couchbase 4.0 Demo Using Views And Indexes. Couchbase 4.0 Beta Main Features Of Couchbase 4.0 Demo
  3. 3. Using Views And Indexes.Using Views And Indexes.
  4. 4. Couchbaseviewsenableindexingandqueryingofdata. Couchbaseviewsenableindexingandqueryingofdata. Views And Indexes.
  5. 5. Views EngineViews Engine
  6. 6. Creating A View.Creating A View.
  7. 7. Creating a View.
  8. 8. Map FunctionMap Function
  9. 9. Results from ViewsResults from Views
  10. 10. View Query ParametersView Query Parameters
  11. 11. Understanding StaleUnderstanding Stale
  12. 12. Built In ReducesBuilt In Reduces
  13. 13. Couchbase 4.0 BetaCouchbase 4.0 Beta
  14. 14. Main Features Of Couchbase 4.0 BetaMain Features Of Couchbase 4.0 Beta Multi Dimensional Scaling Global Secondary Indexing N1Ql (Nickel Query)
  15. 15. Multi Dimensional ScalingMulti Dimensional Scaling
  16. 16. Multi Dimensional ScalingMulti Dimensional Scaling Question: Few million people are looking for a setup to efficiently live and interact. What is the most efficient way to build this infra? A) Build one giant high-rise? B) Build some mid-rises? C) Build many single-family homes
  17. 17. Scaling UpScaling Up Build one big high-rise Vertical Scaling Cluster processors hyper-threading to cores Locally partition workload among processors Communicate over memory Great for fast processing but limited in scalability and elasticity
  18. 18. Scaling OutScaling Out Build a large community of single-family houses Horizontal Scaling Cluster commodity HW Partition workload among nodes Communicate over network Great for scaling and elasticity but slower communication
  19. 19. Multi Dimensional ScalingMulti Dimensional Scaling The Solution to this problem is Multi Dimensional Scaling(MDS). What is Multi-Dimensional Scaling? MDS is the architecture that enables independent scaling of data, query and indexing workloads.
  20. 20. Multi Dimensional ScalingMulti Dimensional Scaling Independent zones for Query, Index and Data Services Independent Scalability for Best Computational Capacity per Service Heavier indexing (index more fields) : scale up index service nodes More RAM for query processing: scale up query service nodes
  21. 21. Global Secondary IndexingGlobal Secondary Indexing
  22. 22. Global Secondary IndexingGlobal Secondary Indexing What are Global Secondary Indexes? High performance indexes for low latency queries with powerful caching, storage and independent placement. Power of GSI: Fully integrated into N1QL Query Optimization and Execution Independent Index Distribution for Limiting scatter-gather Independent Scalability with Index Service
  23. 23. Global Secondary IndexingGlobal Secondary Indexing
  24. 24. GSI vs ViewsGSI vs Views
  25. 25. N1QL (Nickel) QueryN1QL (Nickel) Query
  26. 26. Steps For Running N1QLSteps For Running N1QL Step 1: Start the Cbq engine for datastore and query. For example: Ubuntu users can start it by executing these two commands on the terminal cd /opt/couchbase/bin ./cbq-engine -datastore http://Administrator:[email protected]:8091
  27. 27. Steps For Running N1QLSteps For Running N1QL Step 2: In other Terminal Start the Cbq engine for starting interactive query shell. For example: Ubuntu users can start it by executing these two commands on the terminal Cd /opt/couchbase/bin ./cbq -engine=http://localhost:8093
  28. 28. Enabling Query Parameter.Enabling Query Parameter. To start querying the couchbase from your code you must first the the Query by setting it to 'true' For Example: For Java or Scala Users: System.setProperty("com.couchbase.queryEnabled", "true") Add this line where you are creating your cluster.
  29. 29. Querying Couchbase Using NickelQuerying Couchbase Using Nickel Here is a sample of executing a Nickel query in couchase.
  30. 30. DemoDemo
  31. 31. ReferencesReferences Www.slideshare.com/couchbase Www.couchbase.com (Documentation & Forum)
  32. 32. ThanksThanks