+ All Categories
Home > Software > Why no sql ? Why Couchbase ?

Why no sql ? Why Couchbase ?

Date post: 15-Apr-2017
Category:
Upload: ahmed-rashwan
View: 336 times
Download: 1 times
Share this document with a friend
23
Why noSQL ? Why Couchbase? Ahmed Rashwan
Transcript
Page 1: Why no sql ? Why Couchbase ?

Why noSQL ? Why Couchbase?

Ahmed Rashwan

Page 2: Why no sql ? Why Couchbase ?

Why noSql?

Page 3: Why no sql ? Why Couchbase ?

●Why noSql ?Data :

Unstructured data represent most of the data now.

How to represent social relations in apps like Facebook?

Page 4: Why no sql ? Why Couchbase ?

●Why noSQL?Dynamic number of app users :

New app goes viral.

Seasonal spikes, for example : Christmas.

How to scale your DB easily to accommodate the varying number of users .

Scalability :

Relational DBs (RDBs) are designed to be centralized , they can scale but not as easy as noSQL DBs.

Scalability : Relation DB (RDBs) are designed to be centralized they can scale but not as easy as

noSQL DBs .

Page 5: Why no sql ? Why Couchbase ?

●What are the differences between SQL & noSQL DBs?

RDBs NoSQL DBs

To lookup data in you need to collect it from many tables (JOIN) and combine the result & the same when writing data.

Each piece of data represents an object which contains all its related data especially in (document-based). this consumes more storage- which is cheap nowadays- but allows much faster reads & writes.

Have rigid schema , changing it is extremely hard and mostly avoided.

Schemaless by design which allows you to change your data schema freely & easily.

Page 6: Why no sql ? Why Couchbase ?

●What are the differences between SQL & noSQL DBs?

RDBs NoSQL DBs

Built to scale up as they are centralized which is costly and complex. also even the biggest server can be outstripped by the number of users and data size, at this point you have to scale out which is complex.

Designed to be decentralized , distributed and scale out easily.

Page 7: Why no sql ? Why Couchbase ?

●What are the differences between SQL & noSQL DBs?

RDBs scale up

Page 8: Why no sql ? Why Couchbase ?

●What are the differences between SQL & noSQL DBs?

NoSQL Scale out

Page 9: Why no sql ? Why Couchbase ?

●What are the differences between SQL & noSQL DBs?

RDBs NoSQL DBs

Mostly closed source and require licensing fees.

Open source with a big community but also many have commercial versions.

Page 10: Why no sql ? Why Couchbase ?

●NoSQL DBs Types :key-value store :

Use hash table to store a unique key and a pointer to the data.

Provides great performance & is easy to scale.

Good at : storing user sessions - storing user preferences.

Not so good at : relations between data - provide queries on multiple unique keys.

ex : Redis.

Document-based store :

Stores data like key-value store but instead of storing values we store entire documents.

Documents can be json , xml , bson or binary .

Supports operations on multiple unique keys.

Page 11: Why no sql ? Why Couchbase ?

●NoSQL DBs Types :Good at : Content Management systems - Analytics systems - e-commerce .

Not so good at : frequent access to data - complex search queries.

Ex : Couchbase - Mongo DB .

Column-store :

Stores data in rows that have unique ids and each row has flexible columns.

Differes from RDBs in that you can add/remove columns to a certain row without affecting other rows.

Good at : Content management systems - systems with frequent data access .

Not so good at : Complex search queries on values - querying patterns that change regularly.

Ex : Cassandra - HBase.

Page 12: Why no sql ? Why Couchbase ?

●NoSQL DBs Types :Graph-based :

Stores data in the form of nodes and edges (relationships) between them.

Good at : Social networks - Recommendation engines.

Not so good at : Complex search queries on values - Data that has no relationships between them.

Ex : Neo4j .

Page 13: Why no sql ? Why Couchbase ?

●CAP Theorem :Consistency : you get the same answer from multiple servers at any point of

time.

Availability : All requests to the system receive a response whether success or failure .

Partition tolerance : The system continues to function even if some components fail of some message traffic is lost.

You either have “CP” or “AP” but no “CA” because a system is not distributed without “P”.

“CP” systems support strong consistency in favor of availability, ex : Mongo DB.

Page 14: Why no sql ? Why Couchbase ?

●CAP Theorem :“AP” systems use “eventual

consistency “ as a compromise for having high availability.

Page 15: Why no sql ? Why Couchbase ?

Why CouchBase?

Page 16: Why no sql ? Why Couchbase ?

●Why CouchBase? : CouchBase can used as :

High Availability Cache Key-value store Document DB

Embedded DB Sync Management

Page 17: Why no sql ? Why Couchbase ?

●Couchbase Structure :Node : A Couchbase server instance .

Cluster : Scalable networked set of nodes.

Bucket : Logical space of uniquely keyed documents evenly distributed across a cluster.

Virtual Buckets : each bucket is divided into 1024 segment called “virtual buckets” evenly distributed across all nodes .

If you double the number of nodes then you reduce the number of virtual buckets by half.

Page 18: Why no sql ? Why Couchbase ?

●Couchbase Structure :

Page 19: Why no sql ? Why Couchbase ?

●Couchbase Architecture :

Page 20: Why no sql ? Why Couchbase ?

●Couchbase Facts:Bucket RDB Database , Documents RDB Table.

Adding nodes Rebalance VBuckets Cluster map updated

automatically Zero downtime.

Removing nodes Promote Replicas Cluster map updated

automatically Zero downtime.

Page 21: Why no sql ? Why Couchbase ?

●Couchbase Facts:Couchbase’s XDCR (Cross Datacenter Replication) enables it to scale

out across multiple datacenters.

Applications has single logical connection to Couchbase but multiple pooled connections are maintained by the SDK.

Couchbase SDKs support & encourages Reactive programing.

Page 22: Why no sql ? Why Couchbase ?

Sources:http://www.couchbase.com/nosql-resources/what-is-no-sql

http://www.couchbase.com/nosql-resources/presentations/introduction-to-couchbase-server-%E2%80%93-new-york-2015.html

http://www.slideshare.net/algoworks/choosing-the-right-nosql-database-type

https://blog.andyet.com/2014/10/01/right-database/

http://developer.couchbase.com/documentation/server/4.1/architecture/terminology.html

Images courtesy of Couchbase.com

Page 23: Why no sql ? Why Couchbase ?

Thanks ..


Recommended