Couchbase Server is an open source, distributed, NoSQL document-oriented engagement database. It exposes a fast key-value store with managed cache for sub-millisecond data operations, purpose-built indexers for fast queries and a powerful query engine for executing SQL-like queries. 


NoSQL versus RDBMS

NoSQL encompasses a huge array of different database technologies which were developed as a response to the demands presented in creating modern apps. Developers no structure or no schema, work with apps that build massive volumes of new, quickly changing data types, such as structured, semi-structured, unstructured and polymorphic data.

RDBMS means Relational Database Management System. The data is structured in database fields, tables and records. Each RDBMS table has database table rows. Each and every database table row contains one or more database table fields. 

NoSQL database is better because it has more efficient storage of non-structured data. Unlike relational databases, NoSQL specifies no fixed structure. By dispensing a fixed schema, the responsibility of how the data is stored is shifted to the developer. Therefore, NoSQL does not stand for  a flexible schema, which can be changed at any time. By waiving of a fixed schema, relations between the entries are not necessary. The document is similar to a joined entry of normalized tables of a relational database.

rdbms

NoSQL advantages Description
No structure There is no constraint on the structure of the data to be stored
Integration with Cloud computing Integration with Cloud gives it an edge
Quick development Dynamic and quick development of database
Storage of bulk data Huge amounts of data can be stored


Why Couchbase?

Today’s mission-critical applications demand support for millions of interactions with end-users. Traditional databases were built for thousands. Designed for consistency and control, they lack agility, flexibility, and scalability. To execute multiple use cases, organizations are forced to deploy multiple types of databases, resulting in a “database sprawl” – and inefficiency, sluggish time to market, and poor customer experience. Traditional transactional and analytical databases predate today’s cloud-everywhere reality. A cloud-native data management platform offers you a real competitive edge.

Couchbase Server is specialized to provide low-latency data management for large-scale interactive web, mobile, and IoT applications. Common requirements that Couchbase Server was designed to satisfy include:

Unified Programming Interface

Query

Search

Mobile and IoT

Core database engine

Scale-out architecture

Memory-first architecture

Big data and SQL integrations

Full-stack security

Container and Cloud deployments

High Availability


Couchbase Server is designed to deliver an excellent developer experience and easy administration while also providing outstanding performance at scale, whether in the cloud, in a container, on-premise or on an edge device.

 

Couchbase Server Features:

1. Easy scalability

  • Built-in clustering

  • All nodes are equal

  • One click to scale horizontally

2. Consistent High Performance

  • Built-in managed cache

  • High performance for both reads and writes

3. Always on

  • Data replication with auto-failover

  • Cross Data centre replication

  • Zero-downtime maintenance

  • Monitoring and administration APIs and GUI

Basic Working:

Couchbase is a combination of couchdb + membase. It uses a strict HTTP protocol to query and interact with objects. Objects (documents) are stored in buckets.

To query documents in Couchbase, you define a view with the columns of the document you are interested in (called the map); and then optionally can define some aggregate functions over the data (the reduce step).

If storing customer data and want to query all customers that have not bought any goods for the past three months; one would first have to write a view (the map) that filters these customers; once this view is published – couchbase will optimize searches on this and one can use this view (map) as source on which one execute queries.

One can create multiple views over documents and these views are highly optimized by the system and are only reindexed when the underlying document has significant changes.

This makes couchbase ideal for those situations where one has infrequent changes to the _structure_ of document; and knows in advance what the kinds of queries one will be executing are. One can think of dashboards, realtime updates, etc.

It also offers excellent support for offline databases and built-in master-master replication; making it a good candidate for mobile and other occasionally connected devices.

N1QL – Couch base’s SQL query language

N1QL (pronounced “nickel”) is a SQL 92-compatible query language and query engine that Couchbase developed specifically for querying JSON documents within its NoSQL database.

One can visualize and optimize complex query plans for large datasets and deliver the best performance at any scale to meet the demands of millions of users.

N1QL Sample:

query

Comparison with MongoDB

When comparing Couchbase vs. MongoDB, the former has an entirely different, in-memory architecture that is purpose-built to deliver consistent high performance in distributed environments, at any scale. With Couchbase, you get both amazing performance at scale along with exceptional agility and ease of development and deployment. 

Couchbase and MongoDB are both document oriented databases. They both have a document as their storage unit. MongoDB has an entirely different approach to the same problem. It has a concept of SQL-like queries, and databases and collections. In MongoDB documents live in a collection, and collections are part of a database. In this respect, MongoDB is easier to get familiar with if someone is already comfortable with traditional SQL.

Couchbase and MongoDB both provide commercial support for their databases – MongoDB’s commercial offering is called MongoDB Enterprise and Couchbase has Enterprise Edition (EE).One difference between MongoDB and Couchbase is that MongoDB does not come with a default administration console/GUI – in fact a GUI and a complete hosted management service are offered as a pay option.

One can install any number of third parties GUI to quickly browse your documents; but having one by default would have been nice. Couchbase provides an excellent GUI.

 

Comparison with CouchDB

1) Open source DB – CouchDB is an Apache open source project written in the Erlang language and is free for the user to download. Couchbase is also open source, but it has enterprise, community and developer editions as a portfolio of components. You can download the community edition.


2) Database Lock We know that the traditional DBMS will use lock to ensure the table or a row can’t be modified by different users at the same time. There is no lock in the CouchDB, as it uses a concept called MVCC (Multi Version Concurrency Control). Couchbase, on the other hand, uses pessimistic locking.


3) Query Language – Couchbase has its own query language called N1QL, a SQL-like query language for JSON. CouchDB doesn’t have Query language. They both have similar views that are multi-dimensional/geospatial.

4) Topology
The topology of Couchbase is distributed, which means it is built from scratch and forms a cluster of nodes. Each node in the cluster acts as the owner for a portion of that hash space. But CouchDB is replicated and is master-master replication, making multi-site applications very easy to deploy.


Comparison with Cassandra

Cassandra is a ragged-table key-value store. It just stores rows, each of which has a set of named columns grouped in to families with values. It sounds quite close to Big Table; Big Table doesn’t require each row to have the same structure (unlike an SQL database). The values may have some structure, but this kind of store doesn’t know anything about that — they’re just strings/byte sequences.

Cassandra is highly scalable, high performance distributed database designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. 

Real – Time Couchbase Example

A leading medical technology company, is constantly looking for new ways to improve diagnostics and the delivery of health care. In the case of Type 2 diabetes, a major obstacle to optimized treatment has been the lack of individualized data. It’s too difficult for patients to collect the data, and even when they do, doctors don’t have the time to sort through it all. Its innovative solution is a mobile patient app and clinician portal built on Couchbase and Couchbase Mobile. The solution uses connected medical devices and a mobile app to automatically log real-time data on a patient’s insulin and glucose levels, activities, meals, and location. Based on the data, the mobile app provides patients with customized alerts and recommendations. The clinician portal collects all the data and presents it to doctors in an efficient format for making diagnoses and determining the best course of treatment. Couchbase provides the offline capabilities of the patient application and secure synchronization of patient data from the medical IoT devices to the cloud. It chose Couchbase because Couchbase made it extremely easy to launch the app and portal and to add rules over time as the solution evolved.

References:
https://query-tutorial.couchbase.com/tutorial/#1
https://www.tatvasoft.com/blog/why-nosql-is-required-when-rdbms-is-proven/
https://intellipaat.com/blog/nosql-vs-sql-what-is-better/