Java SDK Maintainer Spring-‐Data-‐Couchbase Maintainer • @daschl • Core dev on NeAy.io • ContribuDng to Reactor, and others • Living in Austria (Vienna)
database project focused on distributed database technology and 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 soHware in both enterprise and community ediJons. Couchbase Open Source Project
Always On 24x365 Grow cluster without applicaJon changes, without downJme with a single click Consistent sub-‐millisecond read and write response Jmes with consistent high throughput No downJme for soHware upgrades, hardware maintenance, etc. JSON JSON JSON JSON JSON PERFORMANCE Flexible Data Model JSON document model with no fixed schema. Couchbase Server
Global singleton supervisor ConfiguraJon manager on each node Rebalance orchestrator Node health monitor one per cluster vBucket state and replicaJon manager hAp REST management API/Web UI HTTP 8091 Erlang port mapper 4369 Distributed Erlang 21100 -‐ 21199 Erlang/OTP storage interface Couchbase EP Engine 11210 Memcapable 2.0 Moxi 11211 Memcapable 1.0 Memcached New Persistence Layer 8092 Query API Query Engine Data Manager Cluster Manager
• Docs distributed evenly across servers • Each server stores both acDve and replica docs Only one server acJve at a Jme • Client library provides app with simple interface to database • Cluster map provides map to which server doc is on App never needs to know • App reads, writes, updates docs • MulDple app servers can access same document at same Dme User Configured Replica Count = 1 READ/WRITE/UPDATE ACTIVE Doc 5 Doc 2 Doc Doc Doc SERVER 1 ACTIVE Doc 4 Doc 7 Doc Doc Doc SERVER 2 Doc 8 ACTIVE Doc 1 Doc 2 Doc Doc Doc REPLICA Doc 4 Doc 1 Doc 8 Doc Doc Doc REPLICA Doc 6 Doc 3 Doc 2 Doc Doc Doc REPLICA Doc 7 Doc 9 Doc 5 Doc Doc Doc SERVER 3 Doc 6 APP SERVER 1 COUCHBASE Client Library CLUSTER MAP COUCHBASE Client Library CLUSTER MAP APP SERVER 2 Doc 9
User Configured Replica Count = 1 ACTIVE Doc 5 Doc 2 Doc Doc Doc SERVER 1 REPLICA Doc 4 Doc 1 Doc 8 Doc Doc Doc APP SERVER 1 COUCHBASE Client Library CLUSTER MAP COUCHBASE Client Library CLUSTER MAP APP SERVER 2 Doc 9 • Indexing work is distributed amongst nodes • Large data set possible • Parallelize the effort • Each node has index for data stored on it • Queries combine the results from required nodes ACTIVE Doc 5 Doc 2 Doc Doc Doc SERVER 2 REPLICA Doc 4 Doc 1 Doc 8 Doc Doc Doc Doc 9 ACTIVE Doc 5 Doc 2 Doc Doc Doc SERVER 3 REPLICA Doc 4 Doc 1 Doc 8 Doc Doc Doc Doc 9 Query
1 SERVER 2 Couchbase Server – San Francisco SERVER 3 SERVER 1 SERVER 2 Couchbase Server – New York OpDmisDc replicaDon Per replicaDon Tunable Parameters OpDmized protocol based on memcached Reliability and performance at scale Cross Data Center ReplicaDon (XDCR)
Flow 2 Managed Cache Disk Queue Disk ReplicaJon Queue App Server Couchbase Server Node Doc 1 Doc 1 Doc 1 To other node XDCR Engine Doc 1 To other cluster
Document Database. • Every document has • a unique idenJfier (“key”) • JSON or binary content (“value”) • Couchbase uses JSON values to build indexes, query data and perform advanced lookups. Couchbase stores the ‘Meta’ of each Document, and the Body (Content)…
“1-‐0002bce0000000000”, “flags”: 0, “expiraJon”: 0, “type”: “json” } document { “uid”: 1234, “firstname”: “Foo”, “lastname”: “Bar”, “age”: 22, “favorite_colors”: [“green”, “red”], “email”: “[email protected]” } Meta InformaDon Including Key (ID) All Keys Unique and Kept in RAM at all Jmes. Document Value Most Recent In Ram And Persisted To Disk JSON Document Structure
Data Template access Repositoriy access ExcepJon TranslaJons Transparent Caching through @Cacheable • Main purpose: POJOs <-‐> JSON • M2 Released! Thanks to David Harrigan! Now on the way to a Release Candidate
Spring-‐Data-‐Commons Jackson Official Couchbase Java Client • Supports Java & XML based ConfiguraDon • Works with Couchbase Server 2.* • Grab snapshots and milestones from the spring repositories!
Spring Data • In 1.0 First class async support • 1.1+ N1QL integraJon (dynamic querying) Ideas from SpringExchange • Spring XD Couchbase Sink and others • Spring Boot Autoconfig & Starters
SERVER 1 SERVER 2 Couchbase Server Channel Sync Gateway Channel Channel Sync Gateway Channel Couchbase Lite for iOS and Android On Premise In the cloud