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.

High performance and high concurrency queries – Connect Silicon Valley 2017

137 views

Published on

Speaker: Alex Ma

This is where the rubber truly hits the road. Join us to see a live demo of the query performance improvements in 5.0 vs. 4.X. In this session we will talk about the performance improvements in 5.0 N1QL as well as show you how to run N1QL queries at scale.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

High performance and high concurrency queries – Connect Silicon Valley 2017

  1. 1. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. HIGH PERFORMANCE AND HIGH CONCURRENCY QUERIES Alex Ma, Principal Architect
  2. 2. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. AGENDA 01/ 02/ 03/ 04/ Testing environment and tools Query pathing Test Results Demo (?)
  3. 3. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 1 TESTING ENVIRONMENT AND TOOLS
  4. 4. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 4 Testing environment • 12x app servers – m4.xl • 1gbe • 4 cpu cores • 16gb ram • Deployed in Amazon AWS • 14 node cluster – c4.8xl • 10gbe • 36 cpu cores • 60gb ram • EBS GP2 volumes • 100 million documents • 500 byte objects • Cluster layout • 6x data nodes • 6x query nodes • 2x index nodes
  5. 5. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 5 Tools - Atop
  6. 6. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 6 Tools - Iperf 4,000,000 5,000,000 6,000,000 7,000,000 8,000,000 9,000,000 10,000,000 Network throughput baseline test (Kbps) cb1 -> cb13 cb2 -> 13 cb3 -> 13 cb4 -> 13 cb5 -> 13 cb6 -> cb13
  7. 7. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 7 Tools - Faker/Python
  8. 8. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 8 Tools: CBImport
  9. 9. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 9 Tools – CBC-N1qlback
  10. 10. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 2 QUERY PATHING
  11. 11. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 11 Query Execution Flow (KV Fetch) INDEX SERVICE QUERY SERVICE DATA SERVICE SERVER CLUSTER CLIENTS 1. Submit the query over REST API 8. Query result 2. Parse, Analyze, create Plan 7. Evaluate: Filter, Join, Aggregate, Sort, Paginate 3. Scan Request; index filters 4. Get qualified doc keys 5. Fetch Request, doc keys 6. Fetch the documents
  12. 12. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 12 Query Execution Flow (Covering Index) INDEX SERVICE QUERY SERVICE SERVER CLUSTER CLIENTS 1. Submit the query over REST API 6. Query result 2. Parse, Analyze, create Plan 5. Evaluate: Filter, Join, Aggregate, Sort, Paginate 3. Scan Request; index filters 4. Get qualified doc keys
  13. 13. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 13 Pattern “Covering Index” • Index selection for a query solely depends on the query predicates • Index keys cover predicates and all attribute references • Avoids fetching the whole document • Performance
  14. 14. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 14 Prepared Statements • Parse, Analyze and Plan once. • Reduces CPU load on Query nodes • Less CPU load = More Queries! • Works with replica indexes for HA AND load balancing
  15. 15. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 3 TEST RESULTS
  16. 16. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 16 Index Building 0 50 100 150 200 250 300 350 400 450 500 4.6.3 MOI, 3idx 5.0 Plasma, 3idx 5.0 MOI, 3idx 5.0 MOI Replica Index build times(seconds) • 2 types of indexes tested • Deferred index with 3 index definitions • Defer leverages the same DCP stream for multiple indexes • Tested with Memory Optimized indexes as well as Plasma • Single index statement using the with REPLICA clause
  17. 17. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 17 Index building – DCP Items replicated per second 100,000 200,000 300,000 400,000 500,000 600,000 700,000 800,000 900,000 1,000,000 DCP Drain rate - Items per second 4.6.3 MOI 5.0 Plasma 5.0 MOI
  18. 18. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 18 Normal Queries 0 10,000 20,000 30,000 40,000 50,000 60,000 70,000 Queries per second 4.6.3 MOI 5.0 Plasma 5.0 MOI
  19. 19. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 19 Normal Query CPU Utilization 1500% 1700% 1900% 2100% 2300% 2500% 2700% 2900% 3100% 3300% 3500% Query Node CPU Utilization % 4.x MOI 5.0 Plasma 5.0 MOI
  20. 20. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 20 Querying with prepared statements 20,000 70,000 120,000 170,000 220,000 Queries per second 4.6.3 MOI 5.0 Plasma 5.0 MOI
  21. 21. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 21 Querying with prepared statements 200% 700% 1200% 1700% 2200% 2700% 3200% 3700% Query node CPU utilization % 4.6.3 MOI 5.0 Plasma 5.0 MOI
  22. 22. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved.
  23. 23. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 4 DEMO
  24. 24. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. THANK YOU
  25. 25. Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2017. All rights reserved. 25 Reference links • https://developer.couchbase.com/documentation/serv er/current/tools/cbimport.html • https://www.atoptool.nl/ • https://developer.couchbase.com/documentation/serv er/current/n1ql/n1ql-language-reference/prepare.html • https://blog.couchbase.com/prepare-for-performance/ • https://github.com/alexmacouchbase/couchbase- scripts/tree/master/connect2017 • https://blog.couchbase.com/gsi-replicas-rebalancing/ • https://developer.couchbase.com/documentation/serv er/5.0/indexes/index-replication.html • http://docs.couchbase.com/sdk-api/couchbase-c- client-2.5.2/md_doc_cbc-n1qlback.html • https://github.com/joke2k/faker

×