SlideShare a Scribd company logo
Presented by Namitha Acharya
CLUSTER OF UNRELIABLE COMMODITY
HARDWARE (COUCHDB)
1
•W
h
a
t
i
s
C
2
•A
C
I
D
S
E
M
A
N
3
•F
U
T
O
N
4
•H
o
w
c
a
n
I
s
e
e
m
y
d
a
5
•R
E
S
T
A
P
I
6
•V
i
e
w
s
7
•M
a
p
R
e
d
u
c
e
D
i
a
l
o
g
8
•M
a
p
R
e
d
u
c
e
i
n
C
o
u
c
h
D
B
9
•R
e
d
u
c
e
/
R
e
R
e
d
u
c
e
10
•R
e
s
t
r
i
c
t
i
o
n
s
o
n
M
a
p
R
e
d
u
c
e
11
•C
o
n
f
l
i
c
t
M
a
n
a
g
e
m
e
n
t
12
•D
a
t
a
b
a
s
e
R
e
p
l
i
c
a
t
i
o
n
13
•S
e
c
u
r
i
t
y
14
e
r
p
r
i
s
e
u
s
i
n
g
C
o
u
c
h
D
B
15
•S
Y
N
T
A
X
16
c
h
D
B
v
s
M
o
n
g
o
D
B
WHAT IS COUCHDB
◎ CouchDB was first released in 2005.
◎ It is an open source database, developed by
Damien Katz ,former Lotus Notes developer at
IBM.
◎ Damien Katz defined it as a "storage system for a
large scale object database“
◎ He self-funded the project for almost two years
and released it as an open source project under
the GNU General Public License.
◎ It focuses on ease of use and completing
embracing the web.
◎ It is a No SQL database.
◎ A document database server, accessible via a
RESTful JSON API.
◎ Ad-hoc and schema-free with a flat address
space.
◎ Distributed, featuring robust, incremental
replication with bi-directional conflict detection
and management.
◎ Recently merged with Membase.
◎ It uses javascript as a query language using
MapReduce.
◎ It uses HTTP protocol for an API.
◎ The distinguishing feature is that provides multi-
master replication.
◎ Later it became an apache project in 2008.Unlike
relational database it does not store data and
relationships in table.
◎ Instead each database is a collection of
independent document.
◎ Each document maintains its own data and self
contained schema.
◎ An application may access multiple databases.
For eg:one stored on user’s mobile phone and on
server.
◎ Document metadata contains revision
information(making it possible to merge
differences occurred while databases are
disconnected).
ACID SEMANTICS
◎ CouchDB implements MVCC(Multi-Version
Concurrency Control) which the need to lock
during writes.
◎ CouchDB reads operation where each client sees
a consistent snapshot of the database from the
beginning to the end of the read operation.
◎ CouchDB can handle a high volume of concurrent
readers and writers without conflict.
FUTON
◎ Administration is supported by a built-in web
application called FUTON.
◎ First version released in 2005.
◎ CouchDB is written in Erlang programming
language, a cross-platform S/W available on
various OS.
◎ CouchDB belongs to document oriented DB
category, available under apache
license(couchdb.apache.org)
HOW CAN I SEE MY DATA?
◎ CouchDB design documents can contain a
“views” section
◎ Views contain Map/Reduce functions
◎ Map/Reduce functions are implemented in
javascript
REST API
◎ All items have a unique URI that gets exposed via
HTTP.
◎ REST uses the HTTP methods POST, GET, PUT
and DELETE for the four basic CRUD (Create,
Read, Update, Delete) operations on all
resources.
VIEWS
◎ Filtering the documents in your database to find
those relevant to a particular process.
◎ Building efficient indexes to find documents by
any value or structure that resides in them
◎ Extracting data from your documents and
presenting it in a specific order.
◎ Use these indexes to represent relationships
among documents.
◎ CouchDB can index views and keep those indexes
updated as documents are added, removed, or
updated.
MAP/REDUCE DIALOG
◎ Bob: So, how do I query the database?
◎ IT guy: It’s not a database. It’s a key-value store.
◎ Bob: OK, it’s not a database. How do I query it?
◎ IT guy: You write a distributed map-reduce
function in Erlang.
◎ Bob: Did you just tell me to go screw myself?
◎ IT guy: I believe I did, Bob.
MAP/REDUCE IN COUCHDB
◎ Map functions have a single parameter a
document, and emit a list of key/value pairs of
JSON values
◉ CouchDB allows arbitrary JSON structures to be used
as keys
◎ Map is called for every document in the database
◉ Efficiency?
◎ emit() function can be called multiple times in the
map function
◎ View results are stored in B-Trees
REDUCE/REREDUCE
◎ The reduce function is optional..
◎ used to produce aggregate results for that view
◎ Reduce functions must accept, as input, results
emitted by its corresponding map function as well
as results returned by the reduce function
itself(rereduce).
◎ On rereduce the key = null
◎ On a large database objects to be reduced will be
sent to your reduce function in batches. These
batches will be broken up on B-tree boundaries,
which may occur in arbitrary places.
RESTRICTIONS ON MAP/REDUCE
◎ Map functions must be referentially transparent.
Given the same doc will always issue the same
key/value pairs
◉ Allows for incremental update
◎ Reduce functions must be able reduce on its
own output
◉ This requirement of reduce functions allows
CouchDB to store off intermediated reductions
directly into inner nodes of btree indexes, and the
view index updates and retrievals will have
logarithmic cost
CONFLICT MANAGEMENT
◎ Conflicts are left to the application to resolve.
1. Involves merging data into one of the documents
2. Deleting the stale one.
◎ Multi-Version Concurrency Control (MVCC)
◎ CouchDB does not attempt to merge the conflicting
revisions this is an application
◎ If there is a conflict in revisions between nodes
◉ App is ultimately responsible for resolving the conflict
◉ All revisions are saved
◉ One revision is selected as the most recent
DATABASE REPLICATION
◎ “CouchDB has built-in conflict detection and
management and the replication process is
incremental and fast, copying only documents
and individual fields changed since the previous
replication.”
◎ Replication is a unidirectional process.
◎ Databases in CouchDB have a sequence number
that gets incremented every time the database is
changed.
SECURITY
◎ Authorizations
◉ Reader - read/write document
◉ Database Admin - compact, add/edit views
◉ Server Admin - create and remove databases
◎ Eventual Consistency
◉ CouchDB guarantees eventual consistency to be
able to provide both availability and partition
tolerance.
◎ Built for Offline
◉ CouchDB can replicate to devices (like smartphones)
that can go offline and handle data sync for you
when the device is back online.
ENTERPRISES THAT USED OR
ARE USING COUCHDB ARE
◎ Ubuntu began using it in 2009 for its
synchronization service "Ubuntu One“.
◎ The BBC, for its dynamic content platforms.
◎ Credit Suisse, for internal use at commodities
department for their marketplace framework.
◎ Meebo, for their social platform (web and
applications) - Meebo was acquired by Google
and was shut down on July 12, 2012.
◎ Sophos, for some of their back-end systems.
ACCESSING DATA VIA HTTP
◎ Applications interact with CouchDB via HTTP.
◎ The following demonstrates a few examples
using cURL, a command-line utility.
◎ These examples assume that CouchDB is running
on localhost (127.0.0.1) on port 5984.
Action Request Response
CHECK SERVER
◎ curl http://127.0.0.1:5984/
◎ {
◎ "couchdb": "Welcome",
◎ "uuid": "85fb71bf700c17267fef77535820e371",
◎ "vendor": {
◎ "name": "The Apache Software Foundation",
◎ "version": "1.5.0"
◎ },
◎ "version": "1.5.0"
◎ }
CREATING A DATABASE
◎ curl -X PUT http://127.0.0.1:5984/albums
◎ { "ok": true }8
INSERTING A DOCUMENT
◎ curl -X PUT http://127.0.0.1:5984/albums/<uuid>
◎ -d '{“title”:“Hello”, “artist”:“World”}'
◎ { "ok": true,
◎ "id": “<uuid>",
◎ "rev": "1-2902191555“
◎ }
COUCHDB V.S. MONGODB
◎ Erlang v.s. C++
◎ JSON v.s. BSON
◎ HTTP v.s. Custom Protocol over TCP/IP
◎ Documents v.s. Collections/Documents
◎ Ranged Query v.s. Object-based Query
◎ MR -> View v.s. MR -> Collection
◎ MVCC v.s. Update in Place
◎ Master-Master v.s. Master-Slave
Thank You

More Related Content

PPTX
OpenLayer's basics
PDF
ח 500-תשריט-חלק 01
PDF
[WSO2Con Asia 2018] Architecting for Container-native Environments
ODP
A performance analysis of OpenStack Cloud vs Real System on Hadoop Clusters
ODP
BigData Hadoop
PDF
Quick overview on mongo db
PPTX
mago3D FOSS4G NA 2018
PPTX
Hadoop Training Tutorial for Freshers
OpenLayer's basics
ח 500-תשריט-חלק 01
[WSO2Con Asia 2018] Architecting for Container-native Environments
A performance analysis of OpenStack Cloud vs Real System on Hadoop Clusters
BigData Hadoop
Quick overview on mongo db
mago3D FOSS4G NA 2018
Hadoop Training Tutorial for Freshers

Similar to Couch DB (20)

PDF
Reducing Database Pain & Costs with Postgres
 
PDF
Scalability 09262012
PDF
ArangoDB – A different approach to NoSQL
PPT
Map reducecloudtech
PDF
Ceph data services in a multi- and hybrid cloud world
PDF
Open event presentation.3 2
PDF
Generating Executable Mappings from RDF Data Cube Data Structure Definitions
PPTX
Duke Docker Day 2014: Research Applications with Docker
DOCX
Windows server Interview question and answers
PPTX
Serving and rendering huge point cloud on mobile devices and web pages.
PDF
EDB Postgres with Containers
 
PDF
DCEU 18: Developing with Docker Containers
PDF
LINBIT_HA_Business_Apr2016
PDF
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
PDF
PDF
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
PDF
JavaScript for Enterprise Applications
PDF
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
Reducing Database Pain & Costs with Postgres
 
Scalability 09262012
ArangoDB – A different approach to NoSQL
Map reducecloudtech
Ceph data services in a multi- and hybrid cloud world
Open event presentation.3 2
Generating Executable Mappings from RDF Data Cube Data Structure Definitions
Duke Docker Day 2014: Research Applications with Docker
Windows server Interview question and answers
Serving and rendering huge point cloud on mobile devices and web pages.
EDB Postgres with Containers
 
DCEU 18: Developing with Docker Containers
LINBIT_HA_Business_Apr2016
DevOpsDays Tel Aviv DEC 2022 | Building A Cloud-Native Platform Brick by Bric...
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
JavaScript for Enterprise Applications
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
Ad

Recently uploaded (20)

PPTX
Sustainable Sites - Green Building Construction
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Construction Project Organization Group 2.pptx
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
DOCX
573137875-Attendance-Management-System-original
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
web development for engineering and engineering
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
OOP with Java - Java Introduction (Basics)
Sustainable Sites - Green Building Construction
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Internet of Things (IOT) - A guide to understanding
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Lecture Notes Electrical Wiring System Components
Construction Project Organization Group 2.pptx
Lesson 3_Tessellation.pptx finite Mathematics
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CYBER-CRIMES AND SECURITY A guide to understanding
573137875-Attendance-Management-System-original
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
web development for engineering and engineering
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
UNIT 4 Total Quality Management .pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
OOP with Java - Java Introduction (Basics)
Ad

Couch DB

  • 1. Presented by Namitha Acharya CLUSTER OF UNRELIABLE COMMODITY HARDWARE (COUCHDB)
  • 3. WHAT IS COUCHDB ◎ CouchDB was first released in 2005. ◎ It is an open source database, developed by Damien Katz ,former Lotus Notes developer at IBM. ◎ Damien Katz defined it as a "storage system for a large scale object database“ ◎ He self-funded the project for almost two years and released it as an open source project under the GNU General Public License.
  • 4. ◎ It focuses on ease of use and completing embracing the web. ◎ It is a No SQL database. ◎ A document database server, accessible via a RESTful JSON API. ◎ Ad-hoc and schema-free with a flat address space.
  • 5. ◎ Distributed, featuring robust, incremental replication with bi-directional conflict detection and management. ◎ Recently merged with Membase. ◎ It uses javascript as a query language using MapReduce.
  • 6. ◎ It uses HTTP protocol for an API. ◎ The distinguishing feature is that provides multi- master replication. ◎ Later it became an apache project in 2008.Unlike relational database it does not store data and relationships in table. ◎ Instead each database is a collection of independent document.
  • 7. ◎ Each document maintains its own data and self contained schema. ◎ An application may access multiple databases. For eg:one stored on user’s mobile phone and on server. ◎ Document metadata contains revision information(making it possible to merge differences occurred while databases are disconnected).
  • 8. ACID SEMANTICS ◎ CouchDB implements MVCC(Multi-Version Concurrency Control) which the need to lock during writes. ◎ CouchDB reads operation where each client sees a consistent snapshot of the database from the beginning to the end of the read operation. ◎ CouchDB can handle a high volume of concurrent readers and writers without conflict.
  • 9. FUTON ◎ Administration is supported by a built-in web application called FUTON. ◎ First version released in 2005. ◎ CouchDB is written in Erlang programming language, a cross-platform S/W available on various OS. ◎ CouchDB belongs to document oriented DB category, available under apache license(couchdb.apache.org)
  • 10. HOW CAN I SEE MY DATA? ◎ CouchDB design documents can contain a “views” section ◎ Views contain Map/Reduce functions ◎ Map/Reduce functions are implemented in javascript
  • 11. REST API ◎ All items have a unique URI that gets exposed via HTTP. ◎ REST uses the HTTP methods POST, GET, PUT and DELETE for the four basic CRUD (Create, Read, Update, Delete) operations on all resources.
  • 12. VIEWS ◎ Filtering the documents in your database to find those relevant to a particular process. ◎ Building efficient indexes to find documents by any value or structure that resides in them ◎ Extracting data from your documents and presenting it in a specific order. ◎ Use these indexes to represent relationships among documents. ◎ CouchDB can index views and keep those indexes updated as documents are added, removed, or updated.
  • 13. MAP/REDUCE DIALOG ◎ Bob: So, how do I query the database? ◎ IT guy: It’s not a database. It’s a key-value store. ◎ Bob: OK, it’s not a database. How do I query it? ◎ IT guy: You write a distributed map-reduce function in Erlang. ◎ Bob: Did you just tell me to go screw myself? ◎ IT guy: I believe I did, Bob.
  • 14. MAP/REDUCE IN COUCHDB ◎ Map functions have a single parameter a document, and emit a list of key/value pairs of JSON values ◉ CouchDB allows arbitrary JSON structures to be used as keys ◎ Map is called for every document in the database ◉ Efficiency? ◎ emit() function can be called multiple times in the map function ◎ View results are stored in B-Trees
  • 15. REDUCE/REREDUCE ◎ The reduce function is optional.. ◎ used to produce aggregate results for that view ◎ Reduce functions must accept, as input, results emitted by its corresponding map function as well as results returned by the reduce function itself(rereduce). ◎ On rereduce the key = null ◎ On a large database objects to be reduced will be sent to your reduce function in batches. These batches will be broken up on B-tree boundaries, which may occur in arbitrary places.
  • 16. RESTRICTIONS ON MAP/REDUCE ◎ Map functions must be referentially transparent. Given the same doc will always issue the same key/value pairs ◉ Allows for incremental update ◎ Reduce functions must be able reduce on its own output ◉ This requirement of reduce functions allows CouchDB to store off intermediated reductions directly into inner nodes of btree indexes, and the view index updates and retrievals will have logarithmic cost
  • 17. CONFLICT MANAGEMENT ◎ Conflicts are left to the application to resolve. 1. Involves merging data into one of the documents 2. Deleting the stale one. ◎ Multi-Version Concurrency Control (MVCC) ◎ CouchDB does not attempt to merge the conflicting revisions this is an application ◎ If there is a conflict in revisions between nodes ◉ App is ultimately responsible for resolving the conflict ◉ All revisions are saved ◉ One revision is selected as the most recent
  • 18. DATABASE REPLICATION ◎ “CouchDB has built-in conflict detection and management and the replication process is incremental and fast, copying only documents and individual fields changed since the previous replication.” ◎ Replication is a unidirectional process. ◎ Databases in CouchDB have a sequence number that gets incremented every time the database is changed.
  • 19. SECURITY ◎ Authorizations ◉ Reader - read/write document ◉ Database Admin - compact, add/edit views ◉ Server Admin - create and remove databases
  • 20. ◎ Eventual Consistency ◉ CouchDB guarantees eventual consistency to be able to provide both availability and partition tolerance. ◎ Built for Offline ◉ CouchDB can replicate to devices (like smartphones) that can go offline and handle data sync for you when the device is back online.
  • 21. ENTERPRISES THAT USED OR ARE USING COUCHDB ARE ◎ Ubuntu began using it in 2009 for its synchronization service "Ubuntu One“. ◎ The BBC, for its dynamic content platforms. ◎ Credit Suisse, for internal use at commodities department for their marketplace framework. ◎ Meebo, for their social platform (web and applications) - Meebo was acquired by Google and was shut down on July 12, 2012. ◎ Sophos, for some of their back-end systems.
  • 22. ACCESSING DATA VIA HTTP ◎ Applications interact with CouchDB via HTTP. ◎ The following demonstrates a few examples using cURL, a command-line utility. ◎ These examples assume that CouchDB is running on localhost (127.0.0.1) on port 5984. Action Request Response
  • 23. CHECK SERVER ◎ curl http://127.0.0.1:5984/ ◎ { ◎ "couchdb": "Welcome", ◎ "uuid": "85fb71bf700c17267fef77535820e371", ◎ "vendor": { ◎ "name": "The Apache Software Foundation", ◎ "version": "1.5.0" ◎ }, ◎ "version": "1.5.0" ◎ }
  • 24. CREATING A DATABASE ◎ curl -X PUT http://127.0.0.1:5984/albums ◎ { "ok": true }8
  • 25. INSERTING A DOCUMENT ◎ curl -X PUT http://127.0.0.1:5984/albums/<uuid> ◎ -d '{“title”:“Hello”, “artist”:“World”}' ◎ { "ok": true, ◎ "id": “<uuid>", ◎ "rev": "1-2902191555“ ◎ }
  • 26. COUCHDB V.S. MONGODB ◎ Erlang v.s. C++ ◎ JSON v.s. BSON ◎ HTTP v.s. Custom Protocol over TCP/IP ◎ Documents v.s. Collections/Documents ◎ Ranged Query v.s. Object-based Query ◎ MR -> View v.s. MR -> Collection ◎ MVCC v.s. Update in Place ◎ Master-Master v.s. Master-Slave