33
Distributed Database

Key-Value NoSQL Database

Embed Size (px)

Citation preview

Page 1: Key-Value NoSQL Database

Distributed Database

Page 2: Key-Value NoSQL Database

Data Model

• Relation

• The Dominant Data Model of Last Couple Decade

• Table, Column, Rows

• Cannot Nest One Tuple Within Another

• Aggregate

• Collection of related object that we wish to treat as a unit

• Consistency Unit

Page 3: Key-Value NoSQL Database

Relational Data Model

Page 4: Key-Value NoSQL Database

Aggregate Data Model

Page 5: Key-Value NoSQL Database

• Aggregate-Ignorant• Relational Data Model

• Graph

• Aggregate-Oriented• Key-Value

• Document

• Column Family

Data Model Types

Page 6: Key-Value NoSQL Database

Distribution Model

• Single Server

• Sharding (Horizontal Scalability)• Put different data on different node.

• Replication • Take the same data and copies it over multiple node.

Page 7: Key-Value NoSQL Database

Sharding

Page 8: Key-Value NoSQL Database

Master-Slave Replication

Page 9: Key-Value NoSQL Database

Peer-to-Peer Replication

Page 10: Key-Value NoSQL Database

Combining Sharding and Replication

Page 11: Key-Value NoSQL Database

Combining Sharding and Replication

Page 12: Key-Value NoSQL Database

Consistency

Page 13: Key-Value NoSQL Database

Update Consistency

• Write-Write Conflict• Lost Update

• Pessimistic Consistency

• Optimistic Consistency

Page 14: Key-Value NoSQL Database

Read Consistency

Page 15: Key-Value NoSQL Database

Replication Inconsistency

Page 16: Key-Value NoSQL Database

Relaxing Consistency

• Eventual Consistency• Quorums

• CAP Theorem• Consistency

• Availability

• Partition Tolerance

Page 17: Key-Value NoSQL Database

CAP Theorem

Page 18: Key-Value NoSQL Database

Key-Value

Group A

Page 19: Key-Value NoSQL Database

What's Key-Value Store

• Simple Hash Table

• Collection of Key-Value Pair

• Associate Array

• The Key Unique Within Collection

Page 20: Key-Value NoSQL Database

Basic Operation

• Insert Pair

• Delete Pair

• Update Value Of Existing Pair

• Find Value Associate With a Particular Key

Page 21: Key-Value NoSQL Database

Performance Factor

• The efficiency of the hashing function.

• The design of the keys and the size of the values being stored and retrieved.

• The distribution of data across partitions.

• The functional patterns that applications follow to store and retrieve data.

Page 22: Key-Value NoSQL Database

Storing All the Data in a Single Bucket

Page 23: Key-Value NoSQL Database

Terminology – Oracle vs. Riak

Page 24: Key-Value NoSQL Database

Some of The Popular Key-Value Databases

• Redis

• Riak

• Memcache DB

• BerkeleyDB

• HamsterDB

• Amazon DynamoDB

• Project Voldemort

Page 25: Key-Value NoSQL Database

Key-Value Store Features

• Consistency• Consistency is applicable only for operations on a single key• Eventually Consistent in Distribute Implementation

• Transaction• Quorum

• Query

• Structure Of Data

• Scaling • Sharding• CAP

Page 26: Key-Value NoSQL Database

Suitable Use Case

• Storing Session Information

• User Profiles, Preferences

• Shopping Cart Data

Page 27: Key-Value NoSQL Database

When Not to Use

• Relation Among Data

• Multioperation Transactions

• Query by Data

• Operations by Sets

Page 28: Key-Value NoSQL Database

Distributed, Masterless, Highly-Available Key-Value Store

Page 29: Key-Value NoSQL Database

Replication

Page 30: Key-Value NoSQL Database

Demo

Page 31: Key-Value NoSQL Database
Page 32: Key-Value NoSQL Database

Redis Features

• Extremely Fast!

• Ability to store more than just strings

• Persistence

• Replication

• Built in LUA support

Page 33: Key-Value NoSQL Database

Demo