01 2012 档案
摘要:实现一个开源KV数据库的想法来源于对目前项目中所使用的K-V数据库使用情况的不满意。先介绍一下我们的目前项目,作为本文的背景:较为底层的分布式运行平台,使用C/C++实现的Actor模型(异步消息传递系统)数据schema简单灵活,使用key-value能够很好表示。数据库有大量的读写请求,有事务需求,数据丢失容忍度很低。当前,从众多的KV和NOSQL存储产品中,我们使用了Berkeley DB作为底层的存储引擎。为什么选择BDB呢?1.与传统的RDBMS相比,简单K-V存储的Berkeley DB(再加入“嵌入式”直接库链接的特性)有着优越的性能,容易满足我们大量读写(尤其是大量写)的需求。
阅读全文
摘要:1.false sharing原因:CPU loads memory into cache by "line"Linux下获取cache line :cat /proc/cpuinfo | grep cache_alignmentor cat /sys/devices/system/cpu/cpuN/cache/indexN/coherency_line_size 以及其他详尽的cpu cache信息Maybe : get cacheline programatically ( via C language )Multi-cpu contention algorithm &
阅读全文
摘要:restrict是C99标准中新添加的关键字,对于从C89标准开始起步学习C语言的同学来说(包括我),第一次看到restrict还是相当陌生的。Wikipedia给出的解释如下:In the C programming language, as of the C99 standard, restrict is a keyword that can be used in pointer declarations. The restrict keyword is a declaration of intent given by the programmer to the compiler. It
阅读全文