Understanding the Storage Architecture
Column-oriented databases
Three key themes emerged:
Column Databases as Nested Maps of Key/Value Pairs
},
“location “ : { “zip” :”23456” } ,
“preference” : { “d/r” : “D” }
},
Laying out the Webtable
Laying out the Webtable
HBASE DISTRIBUTED STORAGE ARCHITECTURE
In HBase a client program could decide to turn WAL on or switch it off.
Switching it off would boost performance but reduce reliability and recovery, in case of failure.
When data is written to a region, it’s first written to the WAL
Then store, and then disk
DOCUMENT STORE INTERNALS
Storing Data in Memory-Mapped Files
Guidelines for Using Collections and Indexes in MongoDB
MongoDB Reliability and Durability
Horizontal Scaling
query on shard key
pulls state from config servers
MongoDB modifier operations
UNDERSTANDING KEY/VALUE STORES IN MEMCACHED AND REDIS
memcached
Redis Internals
Redis Internals
Consistent hashing
Important principle in distributed hash tables
It maps keys to the slots
Example 50 keys distributed to 7 nodes
Value 85 goes to node 1 85 mod 7 is 1
18 mod 7 is 4
When number of nodes change consistant hashing is useful
Consistent Hashing
Object Versioning
Gossip-Based Membership and Hinted Handoff
Gossip-Based Membership and Hinted Handof
CRUD operations
THE UNIQUE PRIMARY KEY
Creating Records in a Document-Centric Database
DBRef
“line_items”: [
{ “item_name”:”latte”, “quantity”:1 },
{
“item_name”:”cappuccino”,“quantity”:1
},
{“item_name”:”regular”, “quantity”:2
} ] };
{ “name” : “latte”, “unit_price” : 4 }
{ “_id” : “cappuccino”, “unit_price” : 4.25 }
{ “_id” : “regular”, “unit_price” : 2 }
> db.products2.save(p4);
> db.products2.save(p5);
> db.products2.save(p6);
order_date: new Date(),
“line_items”: [
{“item_name”: new DBRef(‘products2’, p4._id),“quantity”:1 },
{ “item_name”: new DBRef(‘products2’, p5._id),“quantity”:1},
{“item_name”: new DBRef(‘products2’, p6._id), “quantity”:2 }
]
};
Although similar to the find() method, the findOne()
method returns a document rather than a cursor.
var myDocument = db.bios.findOne();
Accessing Documents from MongoDB
Using the Create Operation in Column-Oriented Databases