摘要:现有的主流的NoSQL存储系统,如Cassandra、BigTable、HBase等在RAM中直接使用跳表、队列或者树结构等方式来管理Key/Value键值对,整个Key/Value集合被称为MemTable。当MemTable中的数据大小达到阈值的时候会被写入磁盘。因为用户的写操作都是将数据写入MemTable,为了避免MemTable中的数据在转存到磁盘时导致用户写操作失败,在转储之前MemTable会将所有数据转存入一个Immutable MemTable,清空后的MemTable继续响应用户的操作,Immutable MemTable负责将数据转存到磁盘,当数据转存完成以后,Imm..
阅读全文
摘要:在看redis源码的时候看到一个strcut sdshdr ,如下:struct sdshdr { int len; int free; char buf[];};代码中对于这个结构体的大小的处理挺奇怪的,试验一下,实验环境为VC6.0,求sizeof大小struct sdshdr { int len; int free; char *buf;};大小是12struct sdshdr { int len; int free; char buf[];};大小为8struct sdshdr { int len; int free; ...
阅读全文
摘要:安装过程见 :http://blog.csdn.net/a600423444/article/details/7203276自己写的一个测试代码,主要是set ,get和del功能#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <stdlib.h>#include "hiredis.h"static inline double micro_time(){ struct timeval tim; dou
阅读全文
摘要:Redis测试过程中的小问题总结 :1,如果想禁止数据写入磁盘,需要关注配置文件中的以下三项: (1)# after 60 sec if at least 10000 keys changed## Note: you can disable saving at all commenting all the "save" lines.save 900 1save 300 10save 60 10000上面的三个是触发同步到磁盘操作的条件,直接屏蔽即可(2)# IMPORTANT: Check the BGREWRITEAOF to check how to rewrite t
阅读全文
摘要:刚才看Leveldb源码的时候,看到leveldb为了避免频繁的new/delete操作, 使用了Arena缓存 ,在缓存上面分配空间以后,使用 placement new 进行初始化详见 SkipList<Key,Comparator>::NewNode(const Key& key, int height)中的 return new (mem) Node(key);placement new 技术使c++中new的 分配空间 和 调用构造函数 这两个功能分开 ,只是在固定的地址调用构造函数。这个技术有利于程序员自己实现一个自己的缓存堆的功能:每次初始化一个对象都可以在一
阅读全文