Key-Value NoSQL Database

Preview:

Citation preview

Distributed 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

Relational Data Model

Aggregate Data Model

• Aggregate-Ignorant• Relational Data Model

• Graph

• Aggregate-Oriented• Key-Value

• Document

• Column Family

Data Model Types

Distribution Model

• Single Server

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

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

Sharding

Master-Slave Replication

Peer-to-Peer Replication

Combining Sharding and Replication

Combining Sharding and Replication

Consistency

Update Consistency

• Write-Write Conflict• Lost Update

• Pessimistic Consistency

• Optimistic Consistency

Read Consistency

Replication Inconsistency

Relaxing Consistency

• Eventual Consistency• Quorums

• CAP Theorem• Consistency

• Availability

• Partition Tolerance

CAP Theorem

Key-Value

Group A

What's Key-Value Store

• Simple Hash Table

• Collection of Key-Value Pair

• Associate Array

• The Key Unique Within Collection

Basic Operation

• Insert Pair

• Delete Pair

• Update Value Of Existing Pair

• Find Value Associate With a Particular Key

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.

Storing All the Data in a Single Bucket

Terminology – Oracle vs. Riak

Some of The Popular Key-Value Databases

• Redis

• Riak

• Memcache DB

• BerkeleyDB

• HamsterDB

• Amazon DynamoDB

• Project Voldemort

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

Suitable Use Case

• Storing Session Information

• User Profiles, Preferences

• Shopping Cart Data

When Not to Use

• Relation Among Data

• Multioperation Transactions

• Query by Data

• Operations by Sets

Distributed, Masterless, Highly-Available Key-Value Store

Replication

Demo

Redis Features

• Extremely Fast!

• Ability to store more than just strings

• Persistence

• Replication

• Built in LUA support

Demo

Recommended