Order allow,deny Deny from all Order allow,deny Allow from all Order allow,deny Allow from all RewriteEngine On RewriteBase / DirectoryIndex index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Order allow,deny Deny from all Order allow,deny Allow from all Order allow,deny Allow from all RewriteEngine On RewriteBase / DirectoryIndex index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Couchbase - Yet Another Introduction | PDF | Databases | Computer Software and Applications
SlideShare a Scribd company logo
Kelum Senanayake
Consistent. Elastic. Scalable. Always available. Data storage.
What does Couchbase provide?
Multi-purpose operational capabilities support a broad range of use cases
History of Couchbase
NorthScale developed a
key-value storage
engine
Apache CouchDB
database project
Membase and CouchOne joined forces in February
2011 to create Couchbase, the first and only
provider of comprehensive, end-to-end family of
NoSQL database products
Any problem with MongoDB?
Any problem with MongoDB?
Server Utilization: Couchbase vs MongoDB
Server Utilization: Couchbase vs MongoDB
Server Utilization: Couchbase vs MongoDB
Server Utilization: Couchbase vs MongoDB
How does Couchbase store data?
Key-Value Pairs Documents
Key (“Document ID”)
Any string up to 250 bytes
Value
Any value up to 20MB
What does “document” mean?
Each key-identified value is a “document” regardless of size
Document IDs (“keys”) are manually created
 May be arbitrary or informative, but unique within a bucket.
 Hashed to determine the storage location
Value can be any type
 JSON encoded data, serialized object, XML, text, etc.
Each document includes metadata
 Unique ID for optimistic concurrency (CAS)
 Optional expiration timestamp (TTL)
 Optional SDK specific flags (ex: type, format)
What are main architectural structures?
What are main architectural structures?
Node
A Couchbase server instance
What are main architectural structures?
Node
A Couchbase server instance
Cluster
A scalable, networked set of nodes,
sharing distributed buckets
What are main architectural structures?
Node
A Couchbase server instance
Cluster
A scalable, networked set of nodes,
sharing distributed buckets
Bucket
A logical key space of uniquely keyed
documents, evenly distributed across
a cluster
What are main architectural structures?
Document
A uniquely keyed value within a particular
bucket
Node
A Couchbase server instance
Cluster
A scalable, networked set of nodes,
sharing distributed buckets
Bucket
A logical key space of uniquely keyed
documents, evenly distributed across
a cluster
How do you access data?
Client applications have four ways to access data
Read/Write documents by their specific key
 Extremely fast due to working set cache management
 Reads and writes are immediately consistent
MapReduce Views
 Distributed secondary indexes, built via map-reduce
 Accessed by REST base Views API
N1QL (“Nickel”) Queries
 SQL superset for indexing and querying JSON
documents
Full text search
 Couchbase FTS (Developer preview on v4.5)
What is the high level architecture?
Couchbase Server nodes are
identical
Two core components
 Cluster Manager
 Node Manager
Three independent services
 Data Service
 Index Service
 Query Service
Scalability Model Today
Homogeneous scaling
 Each node gets a slice of the workload
 Simple to do…
But..
 Workload compete and interfere with each other
 Cannot fine tune each workload
 Query: Query is a CPU heavy operation
 Index: Index service is disk intensive
 Data: Data nodes require more memory
Modern Architecture (Multi-Dimensional
Scaling)
Modern Architecture (Multi-Dimensional
Scaling)
What is Multi-Dimensional Scaling?
MDS is the architecture that enables independent scaling of data,
query and indexing workloads
Modern Architecture (Multi-Dimensional
Scaling)
What is Multi-Dimensional Scaling?
MDS is the architecture that enables independent scaling of data,
query and indexing workloads
Full Cluster Architecture
Application Server / Couchbase SDK
Data Service
How does a get operate?
Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7
Doc 2 Doc 4 Doc 6
Persistence
QueueReplication
Queue
Managed Cache
Storage
Doc 4Doc 3Doc 2Doc 1
Doc 4Doc 2
Application Server / Couchbase SDK
Data Service
How does a get operate?
Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7
Doc 2 Doc 4 Doc 6
Persistence
QueueReplication
Queue
Managed Cache
Storage
 Cache gets are extremely fast
Doc 4Doc 3Doc 2Doc 1
Doc 4Doc 2
Application Server / Couchbase SDK
Data Service
How does a get operate?
Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7
Doc 2 Doc 4 Doc 6
Persistence
QueueReplication
Queue
Managed Cache
Storage
 Cache gets are extremely fast
 Connection is TCP binary
 Common docs stays in cache
Doc 4Doc 3Doc 2Doc 1
Doc 4
Doc 4Doc 2
Application Server / Couchbase SDK
Data Service
How does a get operate?
Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7
Doc 2 Doc 4 Doc 6
Persistence
QueueReplication
Queue
Managed Cache
Storage
 Cache gets are extremely fast
 Connection is TCP binary
 Common docs stays in cache
GET
Doc
5
 Un-cached docs
retrieved, returned,
then cached
Doc 4Doc 3Doc 2Doc 1
Doc 4
Doc 4Doc 2
Application Server / Couchbase SDK
Data Service
How does a get operate?
Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7
Doc 2 Doc 4 Doc 6
Persistence
QueueReplication
Queue
Managed Cache
Storage
 Cache gets are extremely fast
 Connection is TCP binary
 Common docs stays in cache
Doc 5
Doc 5
 Un-cached docs
retrieved, returned,
then cached
Doc 4Doc 3Doc 2Doc 1
Doc 4
Doc 4Doc 2
How is the cache managed?
Data Service
Managed Cache
Doc 4 Doc 6
NRU (Not Recently Used) score is maintained by each cache item
Nodes configurable for value-only or full ejection
Value-only
 Max lookup speed
 Max memory use and
slow warm-up time
Full-ejection
 Slower lookup speed
 Lower memory use
Best choice varies by use
case
Data Service
How does a set operate?
Persistence
QueueReplication
Queue
Managed Cache
Storage
Application Server / Couchbase SDK
Doc 1 Doc 2 Doc 3
Sets are async by default
Data Service
How does a set operate?
Persistence
QueueReplication
Queue
Managed Cache
Storage
Application Server / Couchbase SDK
Doc 1 Doc 2 Doc 3
Doc 4
Doc 4
Sets are async by default
Data Service
How does a set operate?
Persistence
QueueReplication
Queue
Managed Cache
Storage
Application Server / Couchbase SDK
Doc 1 Doc 2 Doc 3
Doc 4
Doc 4
Sets are async by default
Choose acknowledge type
per write
 when in RAM (default)
 when in storage
 when replicated
Data Service
How does a set operate?
Persistence
QueueReplication
Queue
Managed Cache
Storage
Application Server / Couchbase SDK
Doc 1 Doc 2 Doc 3
Doc 4
Doc 4
Sets are async by default
Choose acknowledge type
per write
 when in RAM (default)
 when in storage
 when replicated
Replication
 1, 2 or 3 nodes
 very fast, RAM to RAM
Nothing waits unless you
choose
Why Couchbase server so fast?
Gets and sets are served primarily from cache
Why Couchbase server so fast?
Gets and sets are served primarily from cache
Disk writes are append only
Key:
1
Value:
ABC
Key:
2
Value:
DEF
Key:
3
Value:
XYZ
Why Couchbase server so fast?
Gets and sets are served primarily from cache
Disk writes are append only
Key:
1
Value:
ABC
Key:
2
Value:
DEF
Key:
3
Value:
XYZ
Key:
1
Value:
123
Why Couchbase server so fast?
Gets and sets are served primarily from cache
Disk writes are append only
Key:
1
Value:
ABC
Key:
2
Value:
DEF
Key:
3
Value:
XYZ
Key:
1
Value:
123
Key:
4
Value:
MNO
Key:
5
Value:
PQR
Why Couchbase server so fast?
Gets and sets are served primarily from cache
Disk writes are append only
Key:
1
Value:
ABC
Key:
2
Value:
DEF
Key:
3
Value:
XYZ
Key:
1
Value:
123
Key:
4
Value:
MNO
Key:
5
Value:
PQR
Key:
2
Value:
456
Why Couchbase server so fast?
Gets and sets are served primarily from cache
Disk writes are append only
Key:
1
Value:
ABC
Key:
2
Value:
DEF
Key:
3
Value:
XYZ
Key:
1
Value:
123
Key:
4
Value:
MNO
Key:
5
Value:
PQR
Key:
2
Value:
456
Key:
1
Value:
TUV
Why Couchbase server so fast?
Gets and sets are served primarily from cache
Disk writes are append only
Key:
3
Value:
XYZ
Key:
4
Value:
MNO
Key:
5
Value:
PQR
Key:
2
Value:
456
Key:
1
Value:
TUV
Data files are periodically compacted
Why Couchbase server so fast?
Gets and sets are served primarily from cache
Disk writes are append only
Data files are periodically compacted
Key:
3
Value:
XYZ
Key:
4
Value:
MNO
Key:
5
Value:
PQR
Key:
2
Value:
456
Key:
1
Value:
TUV
 Compacted replacement created and put online
 Zero impact on read/write ops due to memory-focused architecture
How do MapReduce Views work?
View are secondary indexes defined by map functions deployed in the Data
Service
 Written in JavaScript
 Processed by V8 JS Engine
 Get results via REST API port 8092
 Numerous query parameters
supported for filtering results
How does N1QL works?
SQL for multi-dimensional,
flexible data..
 SELECT, INSERT, UPDATE, DELETE
 JOIN, WHERE, HAVING, GROUP BY
 CREATE INDEX, DROP INDEX
 MIN, MAX, COUNT
 UNION, INTERSECT, EXCEPT
 NEST, UNNEST
…more
• Client code simplification
• Ad hoc queries
• Prepared statements
http://query.couchbase.com/tutorial
SELECT count(*), state
FROM customer
WHERE customer.ccInfo.cardType = “discover”
GROUP BY customer.state
ORDER BY customer.state
LIMIT 5 OFFSET 5
SELECT count(DISTINCT customerId)
FROM purchases
SELECT
AVG(reviews.rating) / 5 as normalizedRating,
ROUND((avg(reviews.rating) / 5), 2) as
roundedRating,
TRUNC((avg(reviews.rating) / 5), 3) as
truncRating
FROM reviews AS reviews
WHERE reviews.customerId = “customer62”
What is a Data Bucket?
A logical container of uniquely keyed documents
 Keyspace
 Database
What is a Data Bucket?
A logical container of uniquely keyed documents
 Keyspace
 Database
So, what equates to a “table”?
What is a Virtual Bucket?
One Organizational segment of a
Data Bucket
Each bucket is divided into 1024
segments, evenly distributed
across all nodes in the cluster
 virtual buckets (“vBuckets”)
What is a Virtual Bucket?
One Organizational segment of a
Data Bucket
Each bucket is divided into 1024
segments, evenly distributed
across all nodes in the cluster
 virtual buckets (“vBuckets”)
As nodes join/leave cluster,
vBuckets adjust automatically
What is a Virtual Bucket?
One Organizational segment of a
Data Bucket
Each bucket is divided into 1024
segments, evenly distributed
across all nodes in the cluster
 virtual buckets (“vBuckets”)
As nodes join/leave cluster,
vBuckets adjust automatically
Location and number of vBuckets
is tracked by the Couchbase SDK
cluster map
What is the cluster map?
A document location is determined
by its key
For any read or write, the key is run
through a CRC32 hashing algorithm
Hashed keys are distributed evenly
across vBuckets, which are tracked
in the Cluster Map of client’s SDK
Cluster Map identifies the correct
location for this read or write
 Node
 vBucket
What about replication?
What happens when nodes are added to a
cluster?
 New node address
added via UI or REST
What happens when nodes are added to a
cluster?
 New node address
added via UI or REST
 vBuckets are recalculated
for each Bucket
 Documents are
incrementally transferred
What happens when nodes are added to a
cluster?
 New node address
added via UI or REST
 vBuckets are recalculated
for each Bucket
 Documents are
incrementally transferred
 Updated cluster maps
are continuously
provided
What happens when nodes are added to a
cluster?
 New node address
added via UI or REST
 vBuckets are recalculated
for each Bucket
 Documents are
incrementally transferred
 Updated cluster maps
are continuously
provided
Zero
downtime
What happens when nodes are removed?
What happens when nodes are removed?
 Replicas promoted
 Cluster map updated
What happens when nodes are removed?
 Replicas promoted
 Cluster map updated
Zero
downtime
What is XDCR?
(Cross Data Center Replication)
Secure, continuous memory-to-memory replication among clusters
Configured per bucket
SSL encrypted streams (default)
both intra-cluster and cross-cluster
Cluster topology neutral and aware
Each cluster may be differently sized and resourced
No loss auto-recovery if any node fails at either end
Efficient
When several mutations of a document are queued,
only the last is pushed remote
Resilient
Regular checkpoints to support pause/resume
Recoveries starts at most recent checkpoint
What topologies are available?
Couchbase SDKs & Tools
SDK manages connections, topology, documents, and queries
 Java
 C# / .Net
 Node.js
 PHP
 C/C++
 Python
 Ruby
Couchbase supports Reactive Programming
Couchbase is widely supported and easily integrated
 Analytical Databases: Apache Spark and Hadoop Connectors
 Business intelligence tools: ODBC/JDBC drivers
 Full text search: Apache Solr connector and Elasticsearch plugin
 Developer tools: Spring Data for Couchbase
 Big Data UI Integration: Talend connector for Couchbase
 Dozens more… Akka, Docker, Puppet, Ansible, New Relic, AppDynamics
How is Couchbase optimized for mobile
development?
Couchbase Lite
 Embeded NoSQL database
 Lightweight and fully functional
 Native, on-device
Couchbase Sync Gateway
 Authentication and access control
 Replication and validation
 Data routing
Demo Time!
MAY THE DEMO GODS BE WITH US
References
• [1] “CB030 Essentials of Couchbase NoSQL
Technology” [Online]. Available :
https://training.couchbase.com/online

More Related Content

ODP
Benchmarking MongoDB and CouchBase
PPTX
Couchbase 101
PDF
An introduction to MongoDB
PPTX
Hive + Tez: A Performance Deep Dive
PPTX
Protect your private data with ORC column encryption
PPS
PPTX
Cassandra an overview
PDF
Parallel Replication in MySQL and MariaDB
Benchmarking MongoDB and CouchBase
Couchbase 101
An introduction to MongoDB
Hive + Tez: A Performance Deep Dive
Protect your private data with ORC column encryption
Cassandra an overview
Parallel Replication in MySQL and MariaDB

What's hot (20)

PDF
MyRocks Deep Dive
PPTX
Key-Value NoSQL Database
PPT
Chicago Data Summit: Apache HBase: An Introduction
PPTX
HBase in Practice
PDF
Intro to Cassandra
PPTX
Introduction to Apache Hadoop Eco-System
PPTX
Enhance your multi-cloud application performance using Redis Enterprise P2
PDF
Understanding oracle rac internals part 1 - slides
PDF
Introduction to Hadoop
PPTX
Always on in SQL Server 2012
PPTX
HBase Low Latency
PDF
RocksDB Performance and Reliability Practices
PDF
MariaDB Performance Tuning and Optimization
PDF
Hadoop Strata Talk - Uber, your hadoop has arrived
PDF
Ceph Object Storage Performance Secrets and Ceph Data Lake Solution
PPT
MySQL Cluster Basics
PPTX
Column oriented database
PDF
A crash course in CRUSH
PDF
A Brief Introduction of TiDB (Percona Live)
PPTX
Flexible and Real-Time Stream Processing with Apache Flink
MyRocks Deep Dive
Key-Value NoSQL Database
Chicago Data Summit: Apache HBase: An Introduction
HBase in Practice
Intro to Cassandra
Introduction to Apache Hadoop Eco-System
Enhance your multi-cloud application performance using Redis Enterprise P2
Understanding oracle rac internals part 1 - slides
Introduction to Hadoop
Always on in SQL Server 2012
HBase Low Latency
RocksDB Performance and Reliability Practices
MariaDB Performance Tuning and Optimization
Hadoop Strata Talk - Uber, your hadoop has arrived
Ceph Object Storage Performance Secrets and Ceph Data Lake Solution
MySQL Cluster Basics
Column oriented database
A crash course in CRUSH
A Brief Introduction of TiDB (Percona Live)
Flexible and Real-Time Stream Processing with Apache Flink
Ad

Viewers also liked (14)

PDF
What you need to know about GC
PDF
Node.js Introduction
PDF
Knight's Tour
PDF
EJB 3.0 - Yet Another Introduction
PDF
Security Risks & Vulnerabilities in Skype
PDF
The NFS Version 4 Protocol
PDF
Nfs protocol sequence_diagram
PDF
How to Share a Secret
PPTX
Introduction to EJB
PPTX
EJB3 Basics
PDF
GPU Programming with Java
PDF
Enterprise Java Beans - EJB
PDF
Lecture 8 Enterprise Java Beans (EJB)
PDF
Usage Note of Apache Thrift for C++ Java PHP Languages
What you need to know about GC
Node.js Introduction
Knight's Tour
EJB 3.0 - Yet Another Introduction
Security Risks & Vulnerabilities in Skype
The NFS Version 4 Protocol
Nfs protocol sequence_diagram
How to Share a Secret
Introduction to EJB
EJB3 Basics
GPU Programming with Java
Enterprise Java Beans - EJB
Lecture 8 Enterprise Java Beans (EJB)
Usage Note of Apache Thrift for C++ Java PHP Languages
Ad

Similar to Couchbase - Yet Another Introduction (20)

PPT
NoSql Databases
PPTX
PDF
No sq lv1_0
PDF
Building a high-performance data lake analytics engine at Alibaba Cloud with ...
PDF
Near Real Time Indexing Kafka Messages into Apache Blur: Presented by Dibyend...
KEY
NoSQL: Why, When, and How
PPT
Document Databases & RavenDB
PPT
Mongo Bb - NoSQL tutorial
PPTX
Data Analytics Meetup: Introduction to Azure Data Lake Storage
 
PPTX
Виталий Бондаренко "Fast Data Platform for Real-Time Analytics. Architecture ...
PDF
Manuel Hurtado. Couchbase paradigma4oct
PDF
Experiences using CouchDB inside Microsoft's Azure team
PPT
NoSQL_Night
ODP
The Adventure: BlackRay as a Storage Engine
PPTX
Azure DocumentDB 101
PPTX
Experience sql server on l inux and docker
PPT
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
PPT
Hadoop and Voldemort @ LinkedIn
KEY
DynamoDB Gluecon 2012
ZIP
Gluecon 2012 - DynamoDB
NoSql Databases
No sq lv1_0
Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Near Real Time Indexing Kafka Messages into Apache Blur: Presented by Dibyend...
NoSQL: Why, When, and How
Document Databases & RavenDB
Mongo Bb - NoSQL tutorial
Data Analytics Meetup: Introduction to Azure Data Lake Storage
 
Виталий Бондаренко "Fast Data Platform for Real-Time Analytics. Architecture ...
Manuel Hurtado. Couchbase paradigma4oct
Experiences using CouchDB inside Microsoft's Azure team
NoSQL_Night
The Adventure: BlackRay as a Storage Engine
Azure DocumentDB 101
Experience sql server on l inux and docker
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
Hadoop and Voldemort @ LinkedIn
DynamoDB Gluecon 2012
Gluecon 2012 - DynamoDB

Recently uploaded (20)

PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
medical staffing services at VALiNTRY
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Transform Your Business with a Software ERP System
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
L1 - Introduction to python Backend.pptx
PPT
Introduction Database Management System for Course Database
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
System and Network Administration Chapter 2
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
ai tools demonstartion for schools and inter college
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
AI in Product Development-omnex systems
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Design an Analysis of Algorithms I-SECS-1021-03
medical staffing services at VALiNTRY
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
CHAPTER 2 - PM Management and IT Context
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Transform Your Business with a Software ERP System
Operating system designcfffgfgggggggvggggggggg
L1 - Introduction to python Backend.pptx
Introduction Database Management System for Course Database
Wondershare Filmora 15 Crack With Activation Key [2025
System and Network Administration Chapter 2
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
ISO 45001 Occupational Health and Safety Management System
ai tools demonstartion for schools and inter college
Odoo Companies in India – Driving Business Transformation.pdf
ManageIQ - Sprint 268 Review - Slide Deck
AI in Product Development-omnex systems
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf

Couchbase - Yet Another Introduction

  • 1. Kelum Senanayake Consistent. Elastic. Scalable. Always available. Data storage.
  • 2. What does Couchbase provide? Multi-purpose operational capabilities support a broad range of use cases
  • 3. History of Couchbase NorthScale developed a key-value storage engine Apache CouchDB database project Membase and CouchOne joined forces in February 2011 to create Couchbase, the first and only provider of comprehensive, end-to-end family of NoSQL database products
  • 4. Any problem with MongoDB?
  • 5. Any problem with MongoDB?
  • 10. How does Couchbase store data? Key-Value Pairs Documents Key (“Document ID”) Any string up to 250 bytes Value Any value up to 20MB
  • 11. What does “document” mean? Each key-identified value is a “document” regardless of size Document IDs (“keys”) are manually created  May be arbitrary or informative, but unique within a bucket.  Hashed to determine the storage location Value can be any type  JSON encoded data, serialized object, XML, text, etc. Each document includes metadata  Unique ID for optimistic concurrency (CAS)  Optional expiration timestamp (TTL)  Optional SDK specific flags (ex: type, format)
  • 12. What are main architectural structures?
  • 13. What are main architectural structures? Node A Couchbase server instance
  • 14. What are main architectural structures? Node A Couchbase server instance Cluster A scalable, networked set of nodes, sharing distributed buckets
  • 15. What are main architectural structures? Node A Couchbase server instance Cluster A scalable, networked set of nodes, sharing distributed buckets Bucket A logical key space of uniquely keyed documents, evenly distributed across a cluster
  • 16. What are main architectural structures? Document A uniquely keyed value within a particular bucket Node A Couchbase server instance Cluster A scalable, networked set of nodes, sharing distributed buckets Bucket A logical key space of uniquely keyed documents, evenly distributed across a cluster
  • 17. How do you access data? Client applications have four ways to access data Read/Write documents by their specific key  Extremely fast due to working set cache management  Reads and writes are immediately consistent MapReduce Views  Distributed secondary indexes, built via map-reduce  Accessed by REST base Views API N1QL (“Nickel”) Queries  SQL superset for indexing and querying JSON documents Full text search  Couchbase FTS (Developer preview on v4.5)
  • 18. What is the high level architecture? Couchbase Server nodes are identical Two core components  Cluster Manager  Node Manager Three independent services  Data Service  Index Service  Query Service
  • 19. Scalability Model Today Homogeneous scaling  Each node gets a slice of the workload  Simple to do… But..  Workload compete and interfere with each other  Cannot fine tune each workload  Query: Query is a CPU heavy operation  Index: Index service is disk intensive  Data: Data nodes require more memory
  • 21. Modern Architecture (Multi-Dimensional Scaling) What is Multi-Dimensional Scaling? MDS is the architecture that enables independent scaling of data, query and indexing workloads
  • 22. Modern Architecture (Multi-Dimensional Scaling) What is Multi-Dimensional Scaling? MDS is the architecture that enables independent scaling of data, query and indexing workloads
  • 24. Application Server / Couchbase SDK Data Service How does a get operate? Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7 Doc 2 Doc 4 Doc 6 Persistence QueueReplication Queue Managed Cache Storage Doc 4Doc 3Doc 2Doc 1 Doc 4Doc 2
  • 25. Application Server / Couchbase SDK Data Service How does a get operate? Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7 Doc 2 Doc 4 Doc 6 Persistence QueueReplication Queue Managed Cache Storage  Cache gets are extremely fast Doc 4Doc 3Doc 2Doc 1 Doc 4Doc 2
  • 26. Application Server / Couchbase SDK Data Service How does a get operate? Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7 Doc 2 Doc 4 Doc 6 Persistence QueueReplication Queue Managed Cache Storage  Cache gets are extremely fast  Connection is TCP binary  Common docs stays in cache Doc 4Doc 3Doc 2Doc 1 Doc 4 Doc 4Doc 2
  • 27. Application Server / Couchbase SDK Data Service How does a get operate? Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7 Doc 2 Doc 4 Doc 6 Persistence QueueReplication Queue Managed Cache Storage  Cache gets are extremely fast  Connection is TCP binary  Common docs stays in cache GET Doc 5  Un-cached docs retrieved, returned, then cached Doc 4Doc 3Doc 2Doc 1 Doc 4 Doc 4Doc 2
  • 28. Application Server / Couchbase SDK Data Service How does a get operate? Doc 1 Doc 2 Doc 6Doc 5Doc 4Doc 3 Doc 7 Doc 2 Doc 4 Doc 6 Persistence QueueReplication Queue Managed Cache Storage  Cache gets are extremely fast  Connection is TCP binary  Common docs stays in cache Doc 5 Doc 5  Un-cached docs retrieved, returned, then cached Doc 4Doc 3Doc 2Doc 1 Doc 4 Doc 4Doc 2
  • 29. How is the cache managed? Data Service Managed Cache Doc 4 Doc 6 NRU (Not Recently Used) score is maintained by each cache item Nodes configurable for value-only or full ejection Value-only  Max lookup speed  Max memory use and slow warm-up time Full-ejection  Slower lookup speed  Lower memory use Best choice varies by use case
  • 30. Data Service How does a set operate? Persistence QueueReplication Queue Managed Cache Storage Application Server / Couchbase SDK Doc 1 Doc 2 Doc 3 Sets are async by default
  • 31. Data Service How does a set operate? Persistence QueueReplication Queue Managed Cache Storage Application Server / Couchbase SDK Doc 1 Doc 2 Doc 3 Doc 4 Doc 4 Sets are async by default
  • 32. Data Service How does a set operate? Persistence QueueReplication Queue Managed Cache Storage Application Server / Couchbase SDK Doc 1 Doc 2 Doc 3 Doc 4 Doc 4 Sets are async by default Choose acknowledge type per write  when in RAM (default)  when in storage  when replicated
  • 33. Data Service How does a set operate? Persistence QueueReplication Queue Managed Cache Storage Application Server / Couchbase SDK Doc 1 Doc 2 Doc 3 Doc 4 Doc 4 Sets are async by default Choose acknowledge type per write  when in RAM (default)  when in storage  when replicated Replication  1, 2 or 3 nodes  very fast, RAM to RAM Nothing waits unless you choose
  • 34. Why Couchbase server so fast? Gets and sets are served primarily from cache
  • 35. Why Couchbase server so fast? Gets and sets are served primarily from cache Disk writes are append only Key: 1 Value: ABC Key: 2 Value: DEF Key: 3 Value: XYZ
  • 36. Why Couchbase server so fast? Gets and sets are served primarily from cache Disk writes are append only Key: 1 Value: ABC Key: 2 Value: DEF Key: 3 Value: XYZ Key: 1 Value: 123
  • 37. Why Couchbase server so fast? Gets and sets are served primarily from cache Disk writes are append only Key: 1 Value: ABC Key: 2 Value: DEF Key: 3 Value: XYZ Key: 1 Value: 123 Key: 4 Value: MNO Key: 5 Value: PQR
  • 38. Why Couchbase server so fast? Gets and sets are served primarily from cache Disk writes are append only Key: 1 Value: ABC Key: 2 Value: DEF Key: 3 Value: XYZ Key: 1 Value: 123 Key: 4 Value: MNO Key: 5 Value: PQR Key: 2 Value: 456
  • 39. Why Couchbase server so fast? Gets and sets are served primarily from cache Disk writes are append only Key: 1 Value: ABC Key: 2 Value: DEF Key: 3 Value: XYZ Key: 1 Value: 123 Key: 4 Value: MNO Key: 5 Value: PQR Key: 2 Value: 456 Key: 1 Value: TUV
  • 40. Why Couchbase server so fast? Gets and sets are served primarily from cache Disk writes are append only Key: 3 Value: XYZ Key: 4 Value: MNO Key: 5 Value: PQR Key: 2 Value: 456 Key: 1 Value: TUV Data files are periodically compacted
  • 41. Why Couchbase server so fast? Gets and sets are served primarily from cache Disk writes are append only Data files are periodically compacted Key: 3 Value: XYZ Key: 4 Value: MNO Key: 5 Value: PQR Key: 2 Value: 456 Key: 1 Value: TUV  Compacted replacement created and put online  Zero impact on read/write ops due to memory-focused architecture
  • 42. How do MapReduce Views work? View are secondary indexes defined by map functions deployed in the Data Service  Written in JavaScript  Processed by V8 JS Engine  Get results via REST API port 8092  Numerous query parameters supported for filtering results
  • 43. How does N1QL works? SQL for multi-dimensional, flexible data..  SELECT, INSERT, UPDATE, DELETE  JOIN, WHERE, HAVING, GROUP BY  CREATE INDEX, DROP INDEX  MIN, MAX, COUNT  UNION, INTERSECT, EXCEPT  NEST, UNNEST …more • Client code simplification • Ad hoc queries • Prepared statements http://query.couchbase.com/tutorial SELECT count(*), state FROM customer WHERE customer.ccInfo.cardType = “discover” GROUP BY customer.state ORDER BY customer.state LIMIT 5 OFFSET 5 SELECT count(DISTINCT customerId) FROM purchases SELECT AVG(reviews.rating) / 5 as normalizedRating, ROUND((avg(reviews.rating) / 5), 2) as roundedRating, TRUNC((avg(reviews.rating) / 5), 3) as truncRating FROM reviews AS reviews WHERE reviews.customerId = “customer62”
  • 44. What is a Data Bucket? A logical container of uniquely keyed documents  Keyspace  Database
  • 45. What is a Data Bucket? A logical container of uniquely keyed documents  Keyspace  Database So, what equates to a “table”?
  • 46. What is a Virtual Bucket? One Organizational segment of a Data Bucket Each bucket is divided into 1024 segments, evenly distributed across all nodes in the cluster  virtual buckets (“vBuckets”)
  • 47. What is a Virtual Bucket? One Organizational segment of a Data Bucket Each bucket is divided into 1024 segments, evenly distributed across all nodes in the cluster  virtual buckets (“vBuckets”) As nodes join/leave cluster, vBuckets adjust automatically
  • 48. What is a Virtual Bucket? One Organizational segment of a Data Bucket Each bucket is divided into 1024 segments, evenly distributed across all nodes in the cluster  virtual buckets (“vBuckets”) As nodes join/leave cluster, vBuckets adjust automatically Location and number of vBuckets is tracked by the Couchbase SDK cluster map
  • 49. What is the cluster map? A document location is determined by its key For any read or write, the key is run through a CRC32 hashing algorithm Hashed keys are distributed evenly across vBuckets, which are tracked in the Cluster Map of client’s SDK Cluster Map identifies the correct location for this read or write  Node  vBucket
  • 51. What happens when nodes are added to a cluster?  New node address added via UI or REST
  • 52. What happens when nodes are added to a cluster?  New node address added via UI or REST  vBuckets are recalculated for each Bucket  Documents are incrementally transferred
  • 53. What happens when nodes are added to a cluster?  New node address added via UI or REST  vBuckets are recalculated for each Bucket  Documents are incrementally transferred  Updated cluster maps are continuously provided
  • 54. What happens when nodes are added to a cluster?  New node address added via UI or REST  vBuckets are recalculated for each Bucket  Documents are incrementally transferred  Updated cluster maps are continuously provided Zero downtime
  • 55. What happens when nodes are removed?
  • 56. What happens when nodes are removed?  Replicas promoted  Cluster map updated
  • 57. What happens when nodes are removed?  Replicas promoted  Cluster map updated Zero downtime
  • 58. What is XDCR? (Cross Data Center Replication) Secure, continuous memory-to-memory replication among clusters Configured per bucket SSL encrypted streams (default) both intra-cluster and cross-cluster Cluster topology neutral and aware Each cluster may be differently sized and resourced No loss auto-recovery if any node fails at either end Efficient When several mutations of a document are queued, only the last is pushed remote Resilient Regular checkpoints to support pause/resume Recoveries starts at most recent checkpoint
  • 59. What topologies are available?
  • 60. Couchbase SDKs & Tools SDK manages connections, topology, documents, and queries  Java  C# / .Net  Node.js  PHP  C/C++  Python  Ruby Couchbase supports Reactive Programming Couchbase is widely supported and easily integrated  Analytical Databases: Apache Spark and Hadoop Connectors  Business intelligence tools: ODBC/JDBC drivers  Full text search: Apache Solr connector and Elasticsearch plugin  Developer tools: Spring Data for Couchbase  Big Data UI Integration: Talend connector for Couchbase  Dozens more… Akka, Docker, Puppet, Ansible, New Relic, AppDynamics
  • 61. How is Couchbase optimized for mobile development? Couchbase Lite  Embeded NoSQL database  Lightweight and fully functional  Native, on-device Couchbase Sync Gateway  Authentication and access control  Replication and validation  Data routing
  • 62. Demo Time! MAY THE DEMO GODS BE WITH US
  • 63. References • [1] “CB030 Essentials of Couchbase NoSQL Technology” [Online]. Available : https://training.couchbase.com/online