如何进行k/v存储选型

下面是bitcask的论文里,作者考虑到的目标 • low latency per item read or written • high throughput, especially when writing an incoming stream of random items • ability to handle datasets much larger than RAM w/o degradation • crash friendliness, both in terms of fast recovery and not losing data • ease of backup and restore • a relatively simple,… Continue reading 如何进行k/v存储选型

使用位运算进行取模

一般取模 $A mod B$ 12%8=4 如果 $B = 2^n$ 以使用 $&(B-1)$ 代替 $%B$ 来取模. 12&(8 -1) = 4 12&(2^3 – 1) = 4 glibc strlen 就用到了 #include <string.h> #include <stdlib.h> #undef strlen #ifndef STRLEN # define STRLEN strlen #endif /* Return the length of the null-terminated string STR. Scan for the null terminator quickly by… Continue reading 使用位运算进行取模

Published
Categorized as algorithm

使用man 查询函数的使用方法

man 2 syscalls 查看所有的系统调用 man 2 read查看系统调用read() 在这两个命令中的2都表示我们要在2类(系统调用类)中查询

c++ strlen 与 sizeof

#include <iostream> #include <cstring> using namespace std; int main(void) { char arr[4]; cout<<“—>”<<endl; cout<< “arr 4 len : “<< strlen(arr)<<endl; cout<< “arr 4 len : “<< sizeof(arr)<<endl; arr[0]=’a’; arr[1]=’a’; cout<<“—>”<<endl; cout<< “arr 4 len : “<< strlen(arr)<<endl; cout<< “arr 4 len : “<< sizeof(arr)<<endl; arr[2]=’a’; cout<<“—>”<<endl; cout<< “arr 4 len : “<< strlen(arr)<<endl; cout<< “arr… Continue reading c++ strlen 与 sizeof

Published
Categorized as language