Harman Patil (Editor)

CouchDB

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Initial release
  
2005

CouchDB

Original author(s)
  
Damien Katz, Jan Lehnardt, Noah Slater, Christopher Lenz, J. Chris Anderson, Paul Davis, Adam Kocoloski, Jason Davies, BenoƮt Chesneau, Filipe Manana, Robert Newson

Developer(s)
  
Apache Software Foundation

Stable release
  
2.0.0 / September 20, 2016 (2016-09-20)

Preview release
  
2.0rc4 / August 12, 2016 (2016-08-12)

Repository
  
github.com/apache/couchdb

Apache CouchDB is open source database software that focuses on ease of use and having an architecture that "completely embraces the Web". It has a document-oriented NoSQL database architecture and is implemented in the concurrency-oriented language Erlang; it uses JSON to store data, JavaScript as its query language using MapReduce, and HTTP for an API.

Contents

CouchDB was first released in 2005 and later became an Apache Software Foundation project in 2008.

Unlike a relational database, a CouchDB database does not store data and relationships in tables. Instead, each database is a collection of independent documents. Each document maintains its own data and self-contained schema. An application may access multiple databases, such as one stored on a user's mobile phone and another on a server. Document metadata contains revision information, making it possible to merge any differences that may have occurred while the databases were disconnected.

CouchDB implements a form of multiversion concurrency control (MVCC) so it does not lock the database file during writes. Conflicts are left to the application to resolve. Resolving a conflict generally involves first merging data into one of the documents, then deleting the stale one.

Other features include document-level ACID semantics with eventual consistency, (incremental) MapReduce, and (incremental) replication. One of CouchDB's distinguishing features is multi-master replication, which allows it to scale across machines to build high performance systems. A built-in Web application called Futon helps with administration.

History

Couch is an acronym for cluster of unreliable commodity hardware. The CouchDB project was created in April 2005 by Damien Katz, former Lotus Notes developer at IBM. He self-funded the project for almost two years and released it as an open source project under the GNU General Public License.

In February 2008, it became an Apache Incubator project and was offered under the Apache License instead. A few months after, it graduated to a top-level project. This led to the first stable version being released in July 2010.

In early 2012, Katz left the project to focus on Couchbase Server.

Since Katz's departure, the Apache CouchDB project has continued, releasing 1.2 in April 2012 and 1.3 in April 2013. In July 2013, the CouchDB community merged the codebase for BigCouch, Cloudant's clustered version of CouchDB, into the Apache project. The BigCouch clustering framework is included in the current release of Apache CouchDB.

Native clustering is supported at version 2.0.0. And the new Mango Query Server provides a simple JSON-based way to perform CouchDB queries without JavaScript or MapReduce.

Main features

ACID Semantics
CouchDB provides ACID semantics. It does this by implementing a form of Multi-Version Concurrency Control, meaning that CouchDB can handle a high volume of concurrent readers and writers without conflict.
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.
Distributed Architecture with Replication
CouchDB was designed with bi-direction replication (or synchronization) and off-line operation in mind. That means multiple replicas can have their own copies of the same data, modify it, and then sync those changes at a later time.
Document Storage
CouchDB stores data as "documents", as one or more field/value pairs expressed as JSON. Field values can be simple things like strings, numbers, or dates; but ordered lists and associative arrays can also be used. Every document in a CouchDB database has a unique id and there is no required document schema.
Eventual Consistency
CouchDB guarantees eventual consistency to be able to provide both availability and partition tolerance.
Map/Reduce Views and Indexes
The stored data is structured using views. In CouchDB, each view is constructed by a JavaScript function that acts as the Map half of a map/reduce operation. The function takes a document and transforms it into a single value that it returns. CouchDB can index views and keep those indexes updated as documents are added, removed, or updated.
HTTP API
All items have a unique URI that gets exposed via HTTP. It uses the HTTP methods POST, GET, PUT and DELETE for the four basic CRUD (Create, Read, Update, Delete) operations on all resources.

CouchDB also offers a built-in administration interface accessible via Web called Futon.

Use cases and production deployments

Replication and synchronization capabilities of CouchDB make it ideal for using it in mobile devices, where network connection is not guaranteed, and the application must keep on working offline.

CouchDB is well suited for applications with accumulating, occasionally changing data, on which pre-defined queries are to be run and where versioning is important (CRM, CMS systems, by example). Master-master replication is an especially interesting feature, allowing easy multi-site deployments.

Users

Users of CouchDB include:

  • Amadeus IT Group, for some of their back-end systems.
  • 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 most products were shut down on July 12, 2012.
  • npm, for their package registry.
  • Sophos, for some of their back-end systems.
  • The BBC, for its dynamic content platforms.
  • Canonical began using it in 2009 for its synchronization service "Ubuntu One", but stopped using it in November 2011.
  • AirFi for their portable Inflight Entertainment platform.
  • CANAL+ for international on-demand platform at CANAL+ Overseas.
  • Data manipulation: documents and views

    CouchDB manages a collection of JSON documents. The documents are organised via views. Views are defined with aggregate functions and filters are computed in parallel, much like MapReduce.

    Views are generally stored in the database and their indexes updated continuously. CouchDB supports a view system using external socket servers and a JSON-based protocol. As a consequence, view servers have been developed in a variety of languages (JavaScript is the default, but there are also PHP, Ruby, Python and Erlang).

    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.

    Open source components

    CouchDB includes a number of other open source projects as part of its default package.

    References

    CouchDB Wikipedia


    Similar Topics