博客园  :: 首页  :: 联系 :: 管理

levelDB资料汇总【转载】

Posted on 2013-05-13 08:49  Apprentice89  阅读(342)  评论(0编辑  收藏  举报

leveldb介绍 
http://code.google.com/p/leveldb/ 
http://en.wikipedia.org/wiki/LevelDB 
http://highscalability.com/blog/2011/8/10/leveldb-fast-and-lightweight-keyvalue-database-from-the-auth.html 
http://news.ycombinator.com/item?id=2526032 
http://basho.com/blog/technical/2011/07/01/Leveling-the-Field/ 
http://blog.yufeng.info/archives/1327 
http://www.slideshare.net/sunzhidong/google-leveldb-study-discuss 

leveldb
官方文档 
http://leveldb.googlecode.com/svn/trunk/doc/index.html 
http://leveldb.googlecode.com/svn/trunk/doc/benchmark.html 
http://leveldb.googlecode.com/svn/trunk/doc/impl.html 
http://leveldb.googlecode.com/svn/trunk/doc/table_format.txt 
http://leveldb.googlecode.com/svn/trunk/doc/log_format.txt 

leveldb
内部实现和源码解析 
http://blog.xiaoheshang.info/?cat=26 
http://rdc.taobao.com/blog/cs/?p=1378 
http://www.cnblogs.com/haippy/archive/2011/12/04/2276064.html 

bigtable/mapreduce/gfs/lsm-tree/skiplist
论文 
http://blademaster.ixiezi.com/2010/03/27/bigtable:一个分布式的结构化数据存储系统中文版/ 
http://blademaster.ixiezi.com/2010/03/27/google-mapreduce中文版/ 
http://blademaster.ixiezi.com/2010/03/27/the-google-file-system中文版/ 
http://staff.ustc.edu.cn/~jpq/paper/flash/1996-The%20Log-Structured%20Merge-Tree%20%28LSM-Tree%29.pdf 
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.15.9072&rep=rep1&type=pdf 

Tair ldb 
http://rdc.taobao.com/blog/cs/?p=1394 
http://code.taobao.org/p/tair/wiki/index/ 
http://code.taobao.org/p/tair/src/branches/ldb/src/storage/ldb/ 

相关资料 
http://www.quora.com/What-is-an-SSTable-in-Googles-internal-infrastructure 
http://www.ningoo.net/html/tag/dynamo 
http://wiki.apache.org/cassandra/MemtableSSTable 
http://wiki.apache.org/cassandra/ArchitectureSSTable 
http://en.wikipedia.org/wiki/Queuing_theory 
http://rdc.taobao.com/team/jm/archives/1344 

Notes 
leveldb
Write/Delete: 
DB::Put/Delete(DB::Open
*dbptr = impl) => DBImpl::Write => (1) log: log_->AddRecord (2) memtable: WriteBatchInternal::InsertInto(updates, mem_) 

leveldb
Get: 
DBImpl::Get => (1)
memtable: mem->Get (2) immutable memtable: imm->Get (3) 查文件 versions_->current() => current->Get => Version::Get 

leveldb
Compaction: 
leveldb
Open/Get/Write时都有可能做Compaction: DB::Open/DBImpl::Get/DBImpl::Write(DBImpl::MakeRoomForWrite) =>DBImpl::MaybeScheduleCompaction => env_->Schedule(&DBImpl::BGWork, this) => (1) 启后台线程 PosixEnv::Schedule (2) DBImpl::BGWork => DBImpl::BackgroundCall => DBImpl::BackgroundCompaction 

leveldb
的多线程写: 
DBImpl::Write
的瓶颈在AcquireLoggingResponsibility,多线程写同一个db时互相竞争logger_,性能反而没有单写线程快. 所以为了scale,对leveldbsharding,将keyhash后分到多个db,这样多线程读写不会相互竞争,经测试 num_threads : num_dbs1:1时性能最好,充分利用多核 

leveldb
的性能调优: 
通过sharding/batch writes/increase block_size(size per data block, default 4KB)/increase block_cache(LRUCache, default 8MB)/increase write_buffer_size(memtable size, default 4MB)来提高性能,经过测试,单机24-core采用16 threads/16 shards/1000 batch_sizes/block_size 8K/write_buffer_size 32MB能达到70w+ ops/sec的写性能

 

原文链接:http://hideto.iteye.com/blog/1328921