Wednesday, January 6, 2016

SQL to Couchbase - Quick Reference/ Crash Course

Why Couchbase ? Why migrate from Relational ? For the SQL mind

short notes on Couchbase

Image result for couchbase sql funny



Terminologies

RDBMS           Couchbase/Nosql
Table                Collection/Bucket

Row                  Document

Column             Field

Relationships    Linking and Embedding Documents


Scalability: 
Since Data is consistently increasing , couchbase handles it well when compared to relationalDB


High Performance:
Data Retrieval is faster and data is rendered faster from queries preventing timeouts which is freq in SQL in case of large tables. 


24*365 Availability:
Whenever there is a schema change in SQL or something related to constraints etc we usually need downtime (not at all times) - In case of Couchbase there is no need for Downtime, schema changes can be dynamic. Thus making it a good choice for Agile apps.

Flexible DataModels:
Complex data types can be stored in JSON format - dataStructures such as lists, arrays , hash can be stored easily in JSON format. Think about how much time is saved by preventing the need to fill the LIST/Array from SQL DB in the code.


Architecture:

Consists Mainly of:




Data Manager: Consists Ramcache and the Storage Engine

Cluster Manager: uses Erlang (the same used in whatsapp Servers to manage load better)



Data Types Supported:

string, int, boolean, datetime, number, binary. (stored in base 64 format)

Complex Data types such as Arrays, Hashes, lists can be stored in JSON format

Schema changes can vary document to document i.e in SQL language it can vary from one row to another and can be done dynamically without dropping the existing table and data.


Storage Operations:

Data Stored in the form of Key Value - like hash

Data is stored in Ram Cache . ie. for Read or Write operation in the DB
the Ram Cache acts as the interface. Hence reducing the response time tremendously.
As disk Read / Write (i.e to the DB) takes more time.  For set/ write operation the data is always written to the Ram Cache and put into a Disk write Queue & Replication Queue.
In case of CacheMiss disk read occurs thru Ram Cache some latency will be there.















No comments: