Couchbase Server 2.0 introduces new features for NoSQL document databases including JSON support, indexing and querying, incremental MapReduce, and cross data center replication. It provides easy scalability, high performance, and flexibility. The architecture includes components like the query engine, data manager, and cluster manager distributed across nodes. Couchbase is used by companies for applications requiring scalability, availability, and flexible data models.
4. Couchbase Open Source Project
• Leading NoSQL database project
focused on distributed database
technology and the surrounding
ecosystem
• Supports both key-value and
document-oriented use cases
• All components are available under
the Apache 2.0 Public License
• Obtained as packaged software in Couchbase
both enterprise and community
editions. Open Source Project
5. Couchbase Server
Easy Consistent High
Scalability PE
RFORM ANCE
Performance
Grow cluster without Consistent sub-millisecond
application changes, without read and write response times
downtime with a single click with consistent high throughput
Always Flexible Data
On JSON
JSON JSO
JSON
JSON
N
Model
24x365
No downtime for software JSON document model with
upgrades, hardware no fixed schema.
maintenance, etc.
6. Flexible Data Model
{
“ID”: 1,
“FIRST”: “Dipti”,
“LAST”: “Borkar”,
“ZIP”: “94040”,
“CITY”: “MV”,
“STATE”: “CA”
} JSON JSON
JSON
JSON
• No need to worry about the database when changing your
application
• Records can have different structures, there is no fixed
schema
• Allows painless data model changes for rapid application
development
7. New in 2.0
JSON support Indexing and Querying
JSON
JSON JSO
JSON N
JSON
Incremental Map Reduce Cross data center replication
8. Additional Couchbase Server Features
Built-in clustering – All nodes equal Append-only storage layer
Data replication with auto-failover Online compaction
Zero-downtime maintenance Monitoring and admin API & UI
Built-in managed cached SDK for a variety of languages
9. Couchbase Server 2.0 Architecture
8092 11211 11210
Query API Memcapable 1.0 Memcapable 2.0
Moxi
Query Engine
REST management API/Web UI
vBucket state and replication manager
Memcached
Global singleton supervisor
Rebalance orchestrator
Configuration manager
Node health monitor
Process monitor
Heartbeat
Couchbase EP Engine
Data Manager Cluster Manager
storage interface
New Persistence Layer http on each node one per cluster
Erlang/OTP
HTTP Erlang port mapper Distributed Erlang
8091 4369 21100 - 21199
10. Couchbase Server 2.0 Architecture
8092 11211 11210
Query API Memcapable 1.0 Memcapable 2.0
Moxi
Query Engine
REST management API/Web UI
vBucket state and replication manager
Memcached
Global singleton supervisor
Rebalance orchestrator
Configuration manager
Node health monitor
Process monitor
Heartbeat
Couchbase EP Engine
storage interface
New Persistence Layer http on each node one per cluster
Erlang/OTP
HTTP Erlang port mapper Distributed Erlang
8091 4369 21100 - 21199
12. Single node - Couchbase Write
Operation
Doc 1
App Server
Couchbase Server Node
3 2 3
Managed Cache
To other node Replication
Doc 1
Queue
Disk Queue
Disk
13. Single node - Couchbase Update
Operation
Doc 1’
App Server
Couchbase Server Node
3 2 3
Managed Cache
To other node Replication
1
Doc 1’
Queue
Disk Queue
Disk
Doc 1
14. Single node - Couchbase Read
Operation
Doc 1
GET
App Server
Couchbase Server Node
3 2 3
Managed Cache
To other node Replication
Queue Doc 1
Disk Queue
Disk
Doc 1
15. Basic Operation
APP SERVER 1 APP SERVER 2
COUCHBASE Client Library COUCHBASE Client Library
CLUSTER MAP CLUSTER MAP
READ/WRITE/UPDATE
SERVER 1 SERVER 2 SERVER 3 • Docs distributed evenly across
ACTIVE ACTIVE ACTIVE
servers
Doc 5 Doc Doc 4 Doc Doc 1 Doc • Each server stores both active and
replica docs
Doc 2 Doc Doc 7 Doc Doc 2 Doc Only one server active at a time
• Client library provides app with
Doc 9 Doc Doc 8 Doc Doc 6 Doc
simple interface to database
REPLICA REPLICA REPLICA • Cluster map provides map
to which server doc is on
Doc 4 Doc Doc 6 Doc Doc 7 Doc App never needs to know
Doc 1 Doc Doc 3 Doc Doc 9 Doc • App reads, writes, updates docs
Doc 8 Doc Doc 2 Doc Doc 5 Doc • Multiple app servers can access same
document at same time
COUCHBASE SERVER CLUSTER
User Configured Replica Count = 1
16. Add Nodes to Cluster
APP SERVER 1 APP SERVER 2
COUCHBASE Client Library COUCHBASE Client Library
CLUSTER MAP CLUSTER MAP
READ/WRITE/UPDATE READ/WRITE/UPDATE
SERVER 1 SERVER 2 SERVER 3 SERVER 4 SERVER 5 • Two servers added
ACTIVE ACTIVE ACTIVE ACTIVE ACTIVE
One-click operation
Doc 5 Doc Doc 4 Doc Doc 1 Doc • Docs automatically
rebalanced across
Doc 2 Doc Doc 7 Doc Doc 2 Doc cluster
Even distribution of docs
Minimum doc movement
Doc 9 Doc Doc 8 Doc Doc 6 Doc
• Cluster map updated
REPLICA REPLICA REPLICA REPLICA REPLICA
• App database
Doc 4 Doc Doc 6 Doc Doc 7 Doc calls now distributed
over larger number of
Doc 1 Doc Doc 3 Doc Doc 9 Doc servers
Doc 8 Doc Doc 2 Doc Doc 5 Doc
COUCHBASE SERVER CLUSTER
User Configured Replica Count = 1
17. Fail Over Node
APP SERVER 1 APP SERVER 2
COUCHBASE Client Library COUCHBASE Client Library
CLUSTER MAP CLUSTER MAP
SERVER 1 SERVER 2 SERVER 3 SERVER 4 SERVER 5 • App servers accessing docs
ACTIVE ACTIVE ACTIVE ACTIVE ACTIVE
• Requests to Server 3 fail
Doc 5 Doc Doc 4 Doc Doc 1 Doc Doc 9 Doc Doc 6 Doc
• Cluster detects server failed
Promotes replicas of docs to
Doc 2 Doc Doc 7 Doc Doc 2 Doc Doc 8 Doc Doc active
Updates cluster map
Doc 1 Doc 3
• Requests for docs now go to
REPLICA REPLICA REPLICA REPLICA REPLICA appropriate server
Doc 4 Doc Doc 6 Doc Doc 7 Doc Doc 5 Doc Doc 8 Doc • Typically rebalance
would follow
Doc 1 Doc Doc 3 Doc Doc 9 Doc Doc 2 Doc
COUCHBASE SERVER CLUSTER
User Configured Replica Count = 1
19. Indexing and Querying – The basics
• Define materialized views on JSON documents and then
query across the data set
• Using views you can define
• Primary indexes
• Simple secondary indexes (most common use case)
• Complex secondary, tertiary and composite indexes
• Aggregations (reduction)
• Indexes are eventually indexed
• Queries are eventually consistent
• Built using Map/Reduce technology
• Map and Reduce functions are written in Javascript
20. Indexing and Querying
APP SERVER 1 APP SERVER 2
COUCHBASE Client Library COUCHBASE Client Library
CLUSTER MAP CLUSTER MAP
Query
SERVER 1 SERVER 2 SERVER 3 • Indexing work is distributed
ACTIVE ACTIVE ACTIVE
amongst nodes
Doc 5 Doc Doc 5 Doc Doc 5 Doc • Large data set possible
Doc 2 Doc Doc 2 Doc Doc 2 Doc
• Parallelize the effort
Doc 9 Doc
• Each node has index for data stored
Doc 9 Doc Doc 9 Doc
on it
REPLICA REPLICA REPLICA • Queries combine the results from
Doc 4 Doc
required nodes
Doc 4 Doc Doc 4 Doc
Doc 1 Doc Doc 1 Doc Doc 1 Doc
Doc 8 Doc Doc 8 Doc Doc 8 Doc
COUCHBASE SERVER CLUSTER
User Configured Replica Count = 1
21. Cross Data Center Replication – The basics
• Replicate your Couchbase data across clusters
• Clusters may be spread across geos
• Configured on a per-bucket (per-database) basis
• Supports unidirectional and bidirectional operation
• Application can read and write from both clusters
– Active – Active replication
• Replication throughput scales out linearly
• Different from intra-cluster replication
22. Cross Data Center Replication (XDCR)
SERVER 1 SERVER 2 SERVER 3
ACTIVE ACTIVE ACTIVE COUCHBASE SERVER CLUSTER
Doc Doc Doc NY DATA CENTER
Doc 2 Doc Doc
Doc 9 Doc Doc
RAM RAM RAM
Doc Doc Doc Doc Doc Doc Doc Doc Doc
DISK DISK DISK
SERVER 1 SERVER 2 SERVER 3
ACTIVE ACTIVE ACTIVE
Doc Doc Doc
Doc 2 Doc Doc
Doc 9 Doc Doc
RAM RAM RAM
COUCHBASE SERVER CLUSTER Doc Doc Doc Doc Doc Doc Doc Doc Doc
SF DATA CENTER
DISK DISK DISK
23. Couchbase SDKs
Java SDK User Code
.Net SDK Java client API
CouchbaseClient cb = new CouchbaseClient(listURIs,
"aBucket", "letmein");
cb.set("hello", 0, "world");
cb.get("hello");
Couchbase Java Library
PHP SDK (spymemcached)
Ruby SDK
Couchbase Server
…and many
more
http://www.couchbase.com/develop
25. Demo: The next big social game
3 Objects (documents) within game:
• Players
• Monsters
• Items
Gameplay:
• Players fight monsters
• Monsters drop items
• Players own items
26. Player Document
{
"jsonType": "player",
"uuid": "35767d02-a958-4b83-8179-616816692de1",
"name": "Keith4540",
"hitpoints": 75,
Player ID
"experience": 663,
"level": 4,
"loggedIn": false
}
27. Item Document
{
Item ID
"jsonType": "item",
"name": "Katana_e5890c94-11c6-65746ce6c560",
"uuid": "e5890c94-11c6-4856-a7a6-65746ce6c560",
"ownerId": "Dale9887"
}
Player ID
32. Use Case: Content and metadata store
Building a self-adapting,
interactive learning portal with
Couchbase
33. The Problem
As learning move online in great numbers
Growing need to build interactive learning environments that
0101001001
1101010101
Scale! 0101001010
101010
Scale to millions of Serve MHE as well as third-party Including Support Self-adapt via
learners content open content learning apps usage data
34. The Challenge
Hmmm...this looks kinda Backend is an Interactive Content
like:
+ Content Caching (Scale) Delivery Cloud that must:
+ Social Gaming (Stats)
+ Ad Targeting (Smarts) • Allow for elastic scaling under spike periods
• Ability to catalog & deliver content from many sources
• Consistent low-latency for metadata and stats access
• Require full-text search support for content discovery
• Offer tunable content ranking & recommendation
functions
Experimented with a combination of:
XML Databases In-memory Data Grids
SQL/MR Engines Enterprise Search Servers
36. The Learning Portal
• Designed and built as a
collaboration between MHE Labs
and Couchbase
• Serves as proof-of-concept and
testing harness for Couchbase +
ElasticSearch integration
• Available for download and
further development as open
source code
37. Techniques Used
• Document Modeling
• Metadata & Content Storage
• View Querying to support Content Browsing
• Elastic Search Integration (Full Text Search)
- Content Updated in near Real-Time
- Search Content Summaries
- Relevancy boosted based on User Preferences
• Real-Time Content Updates
• Event Logging for offline analysis
38. Couchbase 2.0 + Elasticsearch
Store full-text articles as well Continuously accept updates
1 as document metadata for 3 from Couchbase with new
image, video and text content in content & stats
Couchbase
Logs user behavior to calculate Combine user preferences
2 user preference statistics (e.g. 4 statistics with custom
relevancy scoring to provide
video > text)
personalized search results
39. Data Model
• Stores content metadata for
media objects and content for
articles
Content Metadata • Includes tags, contributors,
Bucket type information
• Includes pointer to the media
• Stores user view details per
type
User Profiles • Updated every time a user
Bucket views a doc with running count
• To be used for customizing ES
search results per user
preference
• Stores content view details
Content Stats • Updated for every time a
Bucket document is viewed
• To be used for boosting ES
search results based on
popularity
40. Architecture
App Server
External Media Store
Couchbase Ruby SDK queries over HTTP
ES
Data Refs
View Query TS Query
Couchbase
ES Transport
Via
XDCR
MR Views MR Views MR Views MR Views
Elastic Search
Cluster
Couchbase Server Cluster
Rapid app devwithouth the need to perform an expensive alter table operation.
JSON support – natively stored as json, whne you build an app, there is not conversion required. New doc viewing , editing capability. Indexing and querying – look inside your json, build views and query for a key, for ranges or to aggregate data Incremental mapreduce – powers indexing. Build complex views over your data. Great for real-time analytics XDCR – replicate information from one cluster to another cluster
All nodes are equal, single node type, easy to scale your cluster. No single point of failoverEvery node manages some active data and some replica data. Data is distributed across the clsuter and hence the load is also uniformly distributed using auto sharding. We have a fixed number of shards that a key get hashed to. 1024 shards, distributed across the cluster. Replication within the cluster for high availability. Number of replicas are configurable with upto 3 replicas. With auto-failiover or manual failover, replica information is immediately promoted to active Add multiple nodes at a time to grow and shrink your cluster.
1. A set request comes in from the application .2. Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
1. A set request comes in from the application .2. Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
1. A set request comes in from the application .2. Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
Bulletize the text. Make sure the builds work.
Bulletize the text. Make sure build work properly.
Bulletize the text. Make sure build work properly.
Bulletize the text. Make sure the builds work.
Overview of what this feature is
1. A set request comes in from the application .2. Couchbase Server responses back that they key is written3. Couchbase Server then Replicates the data out to memory in the other nodes4. At the same time it is put the data into a write que to be persisted to disk
Partial listing of companies with paid production deploymentsThousands more using open source