ydb的内存模型
2009-09-10 00:00:00 来源:WEB开发网阿宝同学推荐了这个东西,因此周末就大概看了下源码,这里就简要的分析下它的实现,下面是他的特性。
项目地址在这里:
http://code.google.com/p/ydb/
引用
# YDB is a key-value storage library.
# Simple API, only 6 methods (open, close, sync, get, set, del).
# The data files are append-only (aka: log or journal).
# As the data files are immutable it's rsync-friendly (though index is mutable, but should be reasonably small)
# Index is stored in the memory and rarely dumped to the disk.
# As the index is in memory, GET requests need at most one disk-seek.
# SET request requires at most one disk-seek to write the data. On average the cost is 0 disk seeks, due to append-only file structure and operating system write caches.
# It's spinning-disk friendly: it's optimized to take an advantage the fast sequential access to the disk.
# it's flash-disk friendly: data is never modified, so there's no need to read-clear-write flash sectors.
# Once in a while the garbage-collector is started to remove old log files to save disk space. This can slow down the db up to two times.
ydb,它是把index存储在内存中,index的内存模型就是一颗红黑树,每次通过红黑树的key得到对应硬盘上的数据文件,以及所需数据在当前文件的偏移。从而得到当前的数据。它的存储是类似log,就是将数据每次append到文件结尾。
更多精彩
赞助商链接