148
Aspect Ratio Test Slide

Aspect Ratio Test Slide

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Aspect Ratio Test Slide

Aspect Ratio Test Slide

Page 2: Aspect Ratio Test Slide

INTRODUCING APACHE COUCHDB 2.0by Jan Lehnardt at ApacheCon EU 2016 in Sevilla

Page 3: Aspect Ratio Test Slide

JAN LEHNARDT

➤CouchDB since 2006

➤Apache CouchDB since 2008

➤PMC Chair & VP of CouchDB since 2011

➤Longest active contributor

➤CEO at Neighbourhoodie Software in Berlin

Joined CouchDB in 2006, longest standing contributor

Have done everything from evangelising, community work, core engineering.

Still do all of the above

* * *We shipped 2.0 on Sept. 20th, fulfilling the 10+ year development history of CouchDB

Page 4: Aspect Ratio Test Slide
Page 5: Aspect Ratio Test Slide

THE THREE USE-CASES OF COUCHDB

Page 6: Aspect Ratio Test Slide

1. GENERAL PURPOSE DATABASE 2. HIGHLY AVAILABLE & SCALABLE BIG DATA CLUSTER 3. SEAMLESS MOBILE TO CLOUD DATA-SYNCHRONISATION

Page 7: Aspect Ratio Test Slide

1. GENERAL PURPOSE DATABASE 2. HIGHLY AVAILABLE & SCALABLE BIG DATA CLUSTER 3. SEAMLESS MOBILE TO CLOUD DATA-SYNCHRONISATION

Page 8: Aspect Ratio Test Slide

1. GENERAL PURPOSE DATABASE 2. HIGHLY AVAILABLE & SCALABLE BIG DATA CLUSTER 3. SEAMLESS MOBILE TO CLOUD DATA-SYNCHRONISATION

Page 9: Aspect Ratio Test Slide

MIX AND MATCH ANY ONE

Page 10: Aspect Ratio Test Slide

MIX AND MATCH ANY ONE DATA SYNCHRONISATION BETWEEN

ALL USE-CASES

Page 11: Aspect Ratio Test Slide

MOBILE TO CLOUD DATA SYNC

Page 12: Aspect Ratio Test Slide

MOST MOBILE DATA IS OFFLINEfor battery power reasons

Page 13: Aspect Ratio Test Slide

ALMOST 60% OF MOBILE IS ON 2GGoogle Chrome Dev Summit last week

Page 14: Aspect Ratio Test Slide

CouchDB helps you to build compelling applications in the face of spotty networks.

Page 15: Aspect Ratio Test Slide

CouchDB helps you to bring mobile data into the

Cloud for Big Data analysis.

Page 16: Aspect Ratio Test Slide

GENERAL PURPOSE DATABASE

Page 17: Aspect Ratio Test Slide

BASICS

JSON cuts ORM

Page 18: Aspect Ratio Test Slide

BASICS

➤ HTTP

JSON cuts ORM

Page 19: Aspect Ratio Test Slide

BASICS

➤ HTTP➤ JSON

JSON cuts ORM

Page 20: Aspect Ratio Test Slide

BASICS

➤ HTTP➤ JSON

➤ Documents

JSON cuts ORM

Page 21: Aspect Ratio Test Slide

BASICS

➤ HTTP➤ JSON

➤ Documents➤ Unique IDs, content

addressable revisions

JSON cuts ORM

Page 22: Aspect Ratio Test Slide

BASICS

MR: unique

API compatible- design from 10 years ago- other databases have features that start failing unpredictably at scale- CouchDB doesn’t have those features in the first place

Page 23: Aspect Ratio Test Slide

BASICS

➤ Incremental, Persistent Map / Reduce for queries

MR: unique

API compatible- design from 10 years ago- other databases have features that start failing unpredictably at scale- CouchDB doesn’t have those features in the first place

Page 24: Aspect Ratio Test Slide

BASICS

➤ Incremental, Persistent Map / Reduce for queries➤ Changes, “what happened since?”, think `git log` but a real-

time stream for your database

MR: unique

API compatible- design from 10 years ago- other databases have features that start failing unpredictably at scale- CouchDB doesn’t have those features in the first place

Page 25: Aspect Ratio Test Slide

BASICS

➤ Incremental, Persistent Map / Reduce for queries➤ Changes, “what happened since?”, think `git log` but a real-

time stream for your database➤ API Compatible between single node and cluster, apps can grow

without rewrite

MR: unique

API compatible- design from 10 years ago- other databases have features that start failing unpredictably at scale- CouchDB doesn’t have those features in the first place

Page 26: Aspect Ratio Test Slide

BASICS

➤ Incremental, Persistent Map / Reduce for queries➤ Changes, “what happened since?”, think `git log` but a real-

time stream for your database➤ API Compatible between single node and cluster, apps can grow

without rewrite➤ trade-off: no features that wouldn’t scale in single node

version

MR: unique

API compatible- design from 10 years ago- other databases have features that start failing unpredictably at scale- CouchDB doesn’t have those features in the first place

Page 27: Aspect Ratio Test Slide

DESIGN DECISIONS

Page 28: Aspect Ratio Test Slide

DESIGN DECISIONS

➤ Data safety > *

Page 29: Aspect Ratio Test Slide

DESIGN DECISIONS

➤ Data safety > *➤ Fault tolerance

Page 30: Aspect Ratio Test Slide

DESIGN DECISIONS

➤ Data safety > *➤ Fault tolerance

➤ Erlang: only one request can fail, not the whole server

Page 31: Aspect Ratio Test Slide

DESIGN DECISIONS

➤ Data safety > *➤ Fault tolerance

➤ Erlang: only one request can fail, not the whole server

➤ Crash-only design

Page 32: Aspect Ratio Test Slide

DESIGN DECISIONS

➤ Data safety > *➤ Fault tolerance

➤ Erlang: only one request can fail, not the whole server

➤ Crash-only design➤ Everything is resumable

Page 33: Aspect Ratio Test Slide

DESIGN DECISIONS

➤ Data safety > *➤ Fault tolerance

➤ Erlang: only one request can fail, not the whole server

➤ Crash-only design➤ Everything is resumable➤ Everything is idempotent

Page 34: Aspect Ratio Test Slide

Web / API Server

App Server

CouchDB

GENERAL PURPOSE DATABASE

Page 35: Aspect Ratio Test Slide

Web / API Server

App Server

CouchDB

GENERAL PURPOSE DATABASE

Page 36: Aspect Ratio Test Slide

Web / API Server

App Server

CouchDB

BONUS 1: GEO DISTRIBUTIONWeb / API

Server

App Server

CouchDB

EUUS

Sync

Page 37: Aspect Ratio Test Slide

Web / API Server

App Server

CouchDB

BONUS: EXTRAWeb / API

Server

App Server

CouchDB

AfricaUS

Web / API Server

App Server

CouchDB

EU

Sync Sync

Page 38: Aspect Ratio Test Slide

CouchDB

Web / API Server

App Server

SCALABLE CLUSTER

CouchDBCouchDB Cluster

Page 39: Aspect Ratio Test Slide

CouchDB

Web / API Server

App Server ✅

SCALABLE CLUSTER

CouchDBCouchDB Cluster

Page 40: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

CouchDB

Web / API Server

App Server

SCALABLE CLUSTER

CouchDBCouchDB Cluster

Page 41: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

CouchDBCouchDB

Web / API Server

App Server

SCALABLE CLUSTER

CouchDBCouchDB Cluster

Page 42: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

CouchDBCouchDBCouchDB

Web / API Server

App Server

SCALABLE CLUSTER

CouchDBCouchDB Cluster

Page 43: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

CouchDBCouchDBCouchDBCouchDB

Web / API Server

App Server

SCALABLE CLUSTER

CouchDBCouchDB Cluster

Page 44: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

CouchDBCouchDBCouchDBCouchDB

Web / API Server

App Server

SCALABLE CLUSTER

CouchDBCouchDB Cluster

Page 45: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

CouchDB

Web / API Server

App Server

BONUS STILL THERE

CouchDBCouchDB Cluster

Web / API Server

App Server

CouchDBCouchDBCouchDB Cluster

EUUS

Sync

Page 46: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

CouchDBCouchDB CouchDB

Web / API Server

App Server

BONUS STILL THERE

CouchDBCouchDB Cluster

Web / API Server

App Server

CouchDBCouchDBCouchDB Cluster

EUUS

Sync

Page 47: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

CouchDBCouchDBCouchDBCouchDB CouchDB

Web / API Server

App Server

BONUS STILL THERE

CouchDBCouchDB Cluster

Web / API Server

App Server

CouchDBCouchDBCouchDB Cluster

EUUS

Sync

Page 48: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

CouchDBCouchDBCouchDBCouchDBCouchDBCouchDB CouchDB

Web / API Server

App Server

BONUS STILL THERE

CouchDBCouchDB Cluster

Web / API Server

App Server

CouchDBCouchDBCouchDB Cluster

EUUS

Sync

Page 49: Aspect Ratio Test Slide

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

Web / API Server

App Server

CouchDBCouchDBCouchDBCouchDBCouchDBCouchDB CouchDB

Web / API Server

App Server

BONUS STILL THERE

CouchDBCouchDB Cluster

Web / API Server

App Server

CouchDBCouchDBCouchDB Cluster

EUUS

✅Sync

Page 50: Aspect Ratio Test Slide

MOBILE

CouchDBCouchDBCouchDB Cluster

📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱

we started offline first

Page 51: Aspect Ratio Test Slide

MOBILE

✅CouchDBCouchDB

CouchDB Cluster

📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱

we started offline first

Page 52: Aspect Ratio Test Slide

BONUS

CouchDBCouchDBCouchDB Cluster

📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱

Page 53: Aspect Ratio Test Slide

BONUS

CouchDBCouchDBCouchDB Cluster

📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱

Page 54: Aspect Ratio Test Slide

MOBILE

CouchDBCouchDBCouchDB Cluster

📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱

CouchDBCouchDBCouchDB Cluster

EUUS

Sync

Page 55: Aspect Ratio Test Slide

MOBILE

✅CouchDBCouchDB

CouchDB Cluster

📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱📱

CouchDBCouchDBCouchDB Cluster

EUUS

Sync

Page 56: Aspect Ratio Test Slide

COUCHDB 1.X

Data Storage Layer

Synchronisation Protocol

Persistent Map/Reduce Indexes

HTTP Layer

Page 57: Aspect Ratio Test Slide

COUCHDB 2.X

Data Storage Layer

Synchronisation Protocol Map/Reduce

HTTP Layer

Cluster Layer

Query Language

Page 58: Aspect Ratio Test Slide

POUCHDB

Persistent In-Browser Storage

Synchronisation Protocol Map/Reduce

Native JavaScript API

Query Language

Page 59: Aspect Ratio Test Slide

MOBILE

Persistent On-Device Storage

Synchronisation Protocol

Persistent Map/Reduce Indexes

Native iOS & Android APIs

Page 60: Aspect Ratio Test Slide

TOPOLOGIES

Page 61: Aspect Ratio Test Slide

solo

could be single node instance or cluster installation

Page 62: Aspect Ratio Test Slide

hot spare

explain replication a bitone way, resume, delta, conflicts

Page 63: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Database Database

replication details

Page 64: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Database Database

replication details

Page 65: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database Database

replication details

Page 66: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

replication details

Page 67: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

replication details

Page 68: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

replication details

Page 69: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

replication details

Page 70: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

Doc 1 [E, D, C, B, A]

replication details

Page 71: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

Doc 1 [E, D, C, B, A]

replication details

Page 72: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

Doc 1 [E, D, C, B, A] Doc 1 [E, D, C, B, A]

replication details

Page 73: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

Doc 1 [E, D, C, B, A] Doc 1 [E, D, C, B, A]

Doc 1 [F, E, D, C, B, A]

replication details

Page 74: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

Doc 1 [E, D, C, B, A] Doc 1 [E, D, C, B, A]

Doc 1 [F, E, D, C, B, A] Doc 1 [H, E, D, C, B, A]

replication details

Page 75: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

Doc 1 [E, D, C, B, A] Doc 1 [E, D, C, B, A]

Doc 1 [F, E, D, C, B, A] Doc 1 [H, E, D, C, B, A]

replication details

Page 76: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

Doc 1 [E, D, C, B, A] Doc 1 [E, D, C, B, A]

Doc 1 [F, E, D, C, B, A] Doc 1 [H, E, D, C, B, A]

Doc 1 [[F, H], E, D, C, B, A]

replication details

Page 77: Aspect Ratio Test Slide

REPLICATION DETAIL INTERLUDE

Doc 1 [Rev A]

Doc 1 [B, A]

Database

Doc 1 [C, B, A]

Database

Doc 1 [C, B, A]

Doc 1 [D, C, B, A]

Doc 1 [E, D, C, B, A] Doc 1 [E, D, C, B, A]

Doc 1 [F, E, D, C, B, A] Doc 1 [H, E, D, C, B, A]

Doc 1 [[F, H], E, D, C, B, A]

{

_id:"1",

_conflicts:[F,H]

}

replication details

Page 78: Aspect Ratio Test Slide

SYNCHRONISATION PROTOCOLCome see my talk tomorrow 12:00: “Apache CouchDB Sync Deep Dive”

Or Thursday 10:30 if you are still here for ApacheCon EU

We will learn about identity, versioning schemes, revision trees, conflict detection and resolution and the by sequence index

Page 79: Aspect Ratio Test Slide

read-only secondaries

Page 80: Aspect Ratio Test Slide

multi-primary

Page 81: Aspect Ratio Test Slide

multi-primary

Page 82: Aspect Ratio Test Slide

us-east us-west

eu-west

multi-primary

Page 83: Aspect Ratio Test Slide

Sevilla New York

Tokyo

multi-primary

Page 84: Aspect Ratio Test Slide

Tree

Page 85: Aspect Ratio Test Slide

City 1 City 2 City 3 City 4 City 5 City 6 City 7 City 8 City 9

Tree

Page 86: Aspect Ratio Test Slide

City 1 City 2 City 3 City 4 City 5 City 6 City 7 City 8 City 9

County 1 County 2 County 3

Tree

Page 87: Aspect Ratio Test Slide

State 2State 1

City 1 City 2 City 3 City 4 City 5 City 6 City 7 City 8 City 9

County 1 County 2 County 3

Tree

Page 88: Aspect Ratio Test Slide

State 2State 1

City 1 City 2 City 3 City 4 City 5 City 6 City 7 City 8 City 9

County 1 County 2 County 3

Country

Tree

Page 89: Aspect Ratio Test Slide

Till 1 Till 2 Till 3

Store 1

Till 4 Till 5 City 6

Store 2

Region 1 Region 2

Till 7 Till 8 Till 9

Store 3

Corporate

Tree

Page 90: Aspect Ratio Test Slide

Meshc.f. Internet of Things / Industry of Things

Page 91: Aspect Ratio Test Slide

CLUSTER INTERNALS

# Cluster- Amazon Dynamo- Cluster -> nodes- Database -> shards- No Primary Node - any node can answer any request - worst case proxies from other nodes - adds a hop, possible latency optimisation with “cluster aware” client libraries- Consistency: R/W = 1,2,3,N - query n=1 asks only one node - n=2 asks two nodes - n=3 three nodes and so on - >n == mode latency vs. more consistency - optimisation opportunity: balance of probabilities: - do we have to fsync write to two nodes, or is it enough to commit to two memories?- self healing- read repair- full replication support- 99% API compatible

Page 92: Aspect Ratio Test Slide

Cluster

GLOSSARYNode A

Node C

Node B

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 93: Aspect Ratio Test Slide

Cluster

GLOSSARY

➤Amazon DynamoNode A

Node C

Node B

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 94: Aspect Ratio Test Slide

Cluster

GLOSSARY

➤Amazon Dynamo➤A cluster consists of nodes

Node A

Node C

Node B

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 95: Aspect Ratio Test Slide

Cluster

GLOSSARY

➤Amazon Dynamo➤A cluster consists of nodes➤A database consists of shards

Node A

Node C

Node B

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 96: Aspect Ratio Test Slide

Cluster

GLOSSARY

➤Amazon Dynamo➤A cluster consists of nodes➤A database consists of shards➤Consistent hashing

Node A

Node C

Node B

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 97: Aspect Ratio Test Slide

Cluster

GLOSSARY

➤Amazon Dynamo➤A cluster consists of nodes➤A database consists of shards➤Consistent hashing

➤ Document ID -> hash fun -> shard ID

Node A

Node C

Node B

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 98: Aspect Ratio Test Slide

Cluster

GLOSSARY

➤Amazon Dynamo➤A cluster consists of nodes➤A database consists of shards➤Consistent hashing

➤ Document ID -> hash fun -> shard ID

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 2

DB 1 Shard 3

DB 1

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 99: Aspect Ratio Test Slide

Cluster

GLOSSARY

➤Amazon Dynamo➤A cluster consists of nodes➤A database consists of shards➤Consistent hashing

➤ Document ID -> hash fun -> shard ID

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 2

DB 1 Shard 3

DB 1

Document ABC

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 100: Aspect Ratio Test Slide

Cluster

GLOSSARY

➤Amazon Dynamo➤A cluster consists of nodes➤A database consists of shards➤Consistent hashing

➤ Document ID -> hash fun -> shard ID

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 2

DB 1 Shard 3

DB 1

Document ABC

ABC

Physical: Cluster & NodesLogical: Databases & ShardsShard map dynamic: you can put shards on different nodesto scale, first overshard, then move shards to new hardware - has limit - re-sharding in future versionno limit to number of nodes or shards or data stored

Page 101: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

backup shards

Page 102: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=1 Client

backup shards

Page 103: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=1 Client

backup shards

Page 104: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=1 Client

backup shards

Page 105: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=1 Client

backup shards

Page 106: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

Page 107: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=2 Client

Page 108: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=2 Client

Page 109: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=2 Client

Page 110: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=2 Client

Page 111: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

GET abcn=2 Client

Page 112: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

PUT abcn=2 Client

Page 113: Aspect Ratio Test Slide

Cluster

Node A

Node C

Node B

DB 1 Shard 1 DB 1 Shard 1*

DB 1 Shard 1**

PUT abcn=3 Client

Page 114: Aspect Ratio Test Slide

INCREMENTAL,PERSISTENT MAP/REDUCE

- incremental, persistent M/R queries - single left-join possible- Works in single node as well as cluster- Mango query lang compiles to M/R

Page 115: Aspect Ratio Test Slide

Database

ID: Atype: rent

amount: -1000ID: B

type: groceriesamount: -50

ID: Ctype: concert

amount: -30ID: D

type: groceriesamount: -40

ID: Etype: transit

amount: -4

Map index is persisted to diskReduce is also persisted, and available grouped by key, and total, from the same index

Page 116: Aspect Ratio Test Slide

Database Map emit(type, amount)

ID: Atype: rent

amount: -1000ID: B

type: groceriesamount: -50

ID: Ctype: concert

amount: -30ID: D

type: groceriesamount: -40

ID: Etype: transit

amount: -4

key: concert

value: -30

key: groceries

value: -50

key: groceries

value: -40

key: rent

value: -1000

key: transit

value: -4

Map index is persisted to diskReduce is also persisted, and available grouped by key, and total, from the same index

Page 117: Aspect Ratio Test Slide

Database Map emit(type, amount) Reduce sum(amount)

ID: Atype: rent

amount: -1000ID: B

type: groceriesamount: -50

ID: Ctype: concert

amount: -30ID: D

type: groceriesamount: -40

ID: Etype: transit

amount: -4

key: concert

value: -30

key: groceries

value: -50

key: groceries

value: -40

key: rent

value: -1000

key: transit

value: -4

key: concert

value: -30

key: groceries

value: -90

key: rent

value: -1000

key: transit

value: -4

Map index is persisted to diskReduce is also persisted, and available grouped by key, and total, from the same index

Page 118: Aspect Ratio Test Slide

Database Map emit(type, amount) Reduce sum(amount)

ID: Atype: rent

amount: -1000ID: B

type: groceriesamount: -50

ID: Ctype: concert

amount: -30ID: D

type: groceriesamount: -40

ID: Etype: transit

amount: -4

key: concert

value: -30

key: groceries

value: -50

key: groceries

value: -40

key: rent

value: -1000

key: transit

value: -4

key: concert

value: -30

key: groceries

value: -90

key: rent

value: -1000

key: transit

value: -4

Total

-1124

Map index is persisted to diskReduce is also persisted, and available grouped by key, and total, from the same index

Page 119: Aspect Ratio Test Slide

Database Map emit(type, amount) Reduce sum(amount)

ID: Atype: rent

amount: -1000ID: B

type: groceriesamount: -50

ID: Ctype: concert

amount: -30ID: D

type: groceriesamount: -40

ID: Etype: transit

amount: -4

key: concert

value: -30

key: groceries

value: -50

key: groceries

value: -40

key: rent

value: -1000

key: transit

value: -4

key: concert

value: -30

key: groceries

value: -90

key: rent

value: -1000

key: transit

value: -4

Total

-1124

database.couch

Map index is persisted to diskReduce is also persisted, and available grouped by key, and total, from the same index

Page 120: Aspect Ratio Test Slide

Database Map emit(type, amount) Reduce sum(amount)

ID: Atype: rent

amount: -1000ID: B

type: groceriesamount: -50

ID: Ctype: concert

amount: -30ID: D

type: groceriesamount: -40

ID: Etype: transit

amount: -4

key: concert

value: -30

key: groceries

value: -50

key: groceries

value: -40

key: rent

value: -1000

key: transit

value: -4

key: concert

value: -30

key: groceries

value: -90

key: rent

value: -1000

key: transit

value: -4

Total

-1124

database.couch type-amount.view

Map index is persisted to diskReduce is also persisted, and available grouped by key, and total, from the same index

Page 121: Aspect Ratio Test Slide

concert: -30 groceries: -50 groceries: -40 rent: -1000 transit: -4

-90 -1004

-120

-1124

Page 122: Aspect Ratio Test Slide

concert: -30 groceries: -50 groceries: -40 rent: -1000 transit: -4

-90 -1004

-140

-1144

concert: -20

B+tree, shallow: updates very efficient, only very few nodes need touching

Page 123: Aspect Ratio Test Slide

MANGO QUERY LANGUAGE

Page 124: Aspect Ratio Test Slide

MANGO QUERY LANGUAGE

➤ Compiles to Map / Reduce {"selector":{"year":{"$gt":2010}},"fields":["_id","_rev","year","title"],"sort":[{"year":"asc"}],"limit":2,"skip":0}

Page 125: Aspect Ratio Test Slide

RELIABLE DATA STORAGE

Reliable Data Storage- Append only files for storage and index- Data committed to disk is never touched again - no partial updates, that cause inconsistencies during catastrophic events - no need for repairs - instant startup- downside: compaction / garbage collection / vacuum - can run online - in v1: simplest possible, copy live data, swap files - takes iops away from live traffic - hogs FS block cache - in v2 - runs in io “background” - takes longer, but doesn’t take live ops away - compaction by shard, still hogs FS block cache, but only per shard - more compact, by clustering indexes inside file

Page 126: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

ID B+Tree

File

[ ]

[ ]

Footer

Page 127: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

ID B+Tree

File

[ ]

[ ]

Footer

Footer

PUT B

[B]

[B]

B

B

BY

ID

BY

SEQ

Footer

Page 128: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

ID B+Tree

File

[ ]

[ ]

Footer

Footer

PUT B

[B]

[B]

B

B

BY

ID

BY

SEQ

Footer

Page 129: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

ID B+Tree

File

[ ]

[ ]

Footer

Footer

PUT B

[B]

[B]

B

B

BY

ID

BY

SEQ

Footer

Footer

PUT A

[A, B]

[B, A]

Footer

B

B

BY

ID

BY

SEQ

A

A

BY

ID

BY

SEQ

Footer

Page 130: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

ID B+Tree

File

[ ]

[ ]

Footer

Footer

PUT B

[B]

[B]

B

B

BY

ID

BY

SEQ

Footer

Footer

PUT A

[A, B]

[B, A]

Footer

B

B

BY

ID

BY

SEQ

A

A

BY

ID

BY

SEQ

Footer

Page 131: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

ID B+Tree

File

[ ]

[ ]

Footer

Footer

PUT B

[B]

[B]

B

B

BY

ID

BY

SEQ

Footer

Footer

PUT A

[A, B]

[B, A]

Footer

B

B

BY

ID

BY

SEQ

A

A

BY

ID

BY

SEQ

Footer

Footer

A

PUT C

[A, B, C]

[B, A, C]

Footer

B

BY

ID

BY

SEQ

Footer

A

BY

ID

BY

SEQ

B C

C

BY

ID

BY

SEQ

Footer

Page 132: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

ID B+Tree

File

[ ]

[ ]

Footer

Footer

PUT B

[B]

[B]

B

B

BY

ID

BY

SEQ

Footer

Footer

PUT A

[A, B]

[B, A]

Footer

B

B

BY

ID

BY

SEQ

A

A

BY

ID

BY

SEQ

Footer

Footer

A

PUT C

[A, B, C]

[B, A, C]

Footer

B

BY

ID

BY

SEQ

Footer

A

BY

ID

BY

SEQ

B C

C

BY

ID

BY

SEQ

Footer

Page 133: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

File

PUT B*

[A, B*, C]

[A, C, B*]

Footer

B

BY

ID

BY

SEQ

Footer

A

BY

ID

BY

SEQ

Footer

BA C

C

BY

ID

BY

SEQ

Footer

B*

B

BY

ID

BY

SEQ

Footer

*

ID B+Tree

Page 134: Aspect Ratio Test Slide

By-ID-Idx

By-SEQ-Idx

File

PUT B*

[A, B*, C]

[A, C, B*]

Footer

B

BY

ID

BY

SEQ

Footer

A

BY

ID

BY

SEQ

Footer

BA C

C

BY

ID

BY

SEQ

Footer

B*

B

BY

ID

BY

SEQ

Footer

*

ID B+Tree

Page 135: Aspect Ratio Test Slide

COMPACTION V1

Footer

B

BY

ID

BY

SEQ

Footer

A

BY

ID

BY

SEQ

Footer

C

BY

ID

BY

SEQ

Footer

BY

ID

BY

SEQ

Footer

B*

A C B*

BY

ID

BY

SEQ

Footer

BY

ID

BY

SEQ

Copy

Page 136: Aspect Ratio Test Slide

COMPACTION V2

Footer

B

BY

ID

BY

SEQ

Footer

A

Footer

C

BY

ID

BY

SEQ

Footer

BY

ID

BY

SEQ

Footer

B*

A C

BY

ID

BY

SEQ

B*

Footer

Smaller, Indexes clustered, background i/o

BY

ID

BY

SEQ

Page 137: Aspect Ratio Test Slide

COMPACTION V2

Footer

B

BY

ID

BY

SEQ

Footer

A

Footer

C

BY

ID

BY

SEQ

Footer

BY

ID

BY

SEQ

Footer

B*

A C

BY

ID

BY

SEQ

B*

Footer

Smaller, Indexes clustered, background i/o

BY

ID

BY

SEQ

Page 138: Aspect Ratio Test Slide

CASE-STUDIES

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things

Page 139: Aspect Ratio Test Slide

CASE STUDIES

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things: 14% of all industrial facilities (think oil refinery, plant, etc) are networked, and < 20% of those are connected to the public internet.

Page 140: Aspect Ratio Test Slide

CASE STUDIES

➤ IBM/Cloudant: Big Data as a Service

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things: 14% of all industrial facilities (think oil refinery, plant, etc) are networked, and < 20% of those are connected to the public internet.

Page 141: Aspect Ratio Test Slide

CASE STUDIES

➤ IBM/Cloudant: Big Data as a Service➤ eHealth Africa: Fighting Ebola with CouchDB and PouchDB

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things: 14% of all industrial facilities (think oil refinery, plant, etc) are networked, and < 20% of those are connected to the public internet.

Page 142: Aspect Ratio Test Slide

CASE STUDIES

➤ IBM/Cloudant: Big Data as a Service➤ eHealth Africa: Fighting Ebola with CouchDB and PouchDB➤ Hospital Run: Hospital management software for regions with

limited infrastructure

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things: 14% of all industrial facilities (think oil refinery, plant, etc) are networked, and < 20% of those are connected to the public internet.

Page 143: Aspect Ratio Test Slide

CASE STUDIES

➤ IBM/Cloudant: Big Data as a Service➤ eHealth Africa: Fighting Ebola with CouchDB and PouchDB➤ Hospital Run: Hospital management software for regions with

limited infrastructure➤ RapidFTR: Family Tracing & Reunification for regions in crisis (e.g.

Haiti) / UNICEF

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things: 14% of all industrial facilities (think oil refinery, plant, etc) are networked, and < 20% of those are connected to the public internet.

Page 144: Aspect Ratio Test Slide

CASE STUDIES

➤ IBM/Cloudant: Big Data as a Service➤ eHealth Africa: Fighting Ebola with CouchDB and PouchDB➤ Hospital Run: Hospital management software for regions with

limited infrastructure➤ RapidFTR: Family Tracing & Reunification for regions in crisis (e.g.

Haiti) / UNICEF➤ Decisions for Heroes: Coast guard mobile operations center

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things: 14% of all industrial facilities (think oil refinery, plant, etc) are networked, and < 20% of those are connected to the public internet.

Page 145: Aspect Ratio Test Slide

CASE STUDIES

➤ IBM/Cloudant: Big Data as a Service➤ eHealth Africa: Fighting Ebola with CouchDB and PouchDB➤ Hospital Run: Hospital management software for regions with

limited infrastructure➤ RapidFTR: Family Tracing & Reunification for regions in crisis (e.g.

Haiti) / UNICEF➤ Decisions for Heroes: Coast guard mobile operations center➤ Avalanche protection inspection in the Swiss Alps

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things: 14% of all industrial facilities (think oil refinery, plant, etc) are networked, and < 20% of those are connected to the public internet.

Page 146: Aspect Ratio Test Slide

CASE STUDIES

➤ IBM/Cloudant: Big Data as a Service➤ eHealth Africa: Fighting Ebola with CouchDB and PouchDB➤ Hospital Run: Hospital management software for regions with

limited infrastructure➤ RapidFTR: Family Tracing & Reunification for regions in crisis (e.g.

Haiti) / UNICEF➤ Decisions for Heroes: Coast guard mobile operations center➤ Avalanche protection inspection in the Swiss Alps➤ Industry of things

# Case Studies (maybe splice into use-cases)IBM/Cloudant: Big Data as a ServiceeEhealth Ebola / Hospital Run / RapidFTR (Family Tracing and Reunification UNICEF / Primero)if-control: avalanche protection inspectionIndustry of things: 14% of all industrial facilities (think oil refinery, plant, etc) are networked, and < 20% of those are connected to the public internet.

Page 147: Aspect Ratio Test Slide

THANK YOU!Introducing Apache CouchDB 2.0

Jan Lehnardt @janl [email protected] Professional Support for Apache CouchDB: https://neighbourhood.ie

Page 148: Aspect Ratio Test Slide