确定mapkeeper使用的leverdb库路径

目前libleveldb的a或so库有三个路径,/usr/lib, /usr/lib/x86_64-linux-gnu , /usr/local/lib

 使用

ls -d -1 /usr/lib/*  /usr/lib/x86_64-linux-gnu/*  /usr/local/lib/* |grep leveldb

列出他们的全路径。

(1)/usr/lib/x86_64-linux-gnu/libleveldb.a会起作用,注意重新编译时清空缓存已保证结果正确。编译出的

(2)/usr/lib/x86_64-linux-gnu/xxxlibleveldb.so不起作用

(3)/usr/local/lib/libleveldb.a会起作用,编译出的mapkeeper_leveldb大小为945KB。

leveldb1.8编译出的a库大小为797K, leveldb2.0编译出的a库为815K

*********注意***********, 如果mapkeeper服务端leveldb提示status: IO error: lock data/usertable/LOCK: already held by process,则操作是不成功的,即使ycsb这端显示成功。实际上leveldb数据库里没有任何变动。发现这一点是因为发现leveldb库的put函数没有被调用。

正常情况下,leveldb插入函数被调用的顺序是

dbimpl.cc, DBImpl::Put,begin
dbimpl.cc, DB::Put, begin
dbimpl.cc, DBImpl::Write begin

dbimpl.cc, MakeRoomForWrite, begin

经过打印发现,在mapkeeper下,options_.write_buffer_size=1073741824, 而在db_bench下,options_.write_buffer_size=4194304

而mapkeeper这个设置是在LevelDbServer.cpp里面的,options.write_buffer_size = writeBufferSizeMb_ * 1024 * 1024;

 cache size, kNoCompression等也是在这里设置的。

经过设置与db_bench一样的配置,ycsb单线程结果 

[OVERALL], RunTime(ms), 544708.0                  相比db_bench是200多秒,差了一倍多
[OVERALL], Throughput(ops/sec), 18358.45994551209

ycsb 8线程结果

[OVERALL], RunTime(ms), 458383.0
[OVERALL], Throughput(ops/sec), 21815.817776837273

16线程

[OVERALL], RunTime(ms), 433804.0
[OVERALL], Throughput(ops/sec), 23051.88518317028

原文地址:https://www.cnblogs.com/bettersky/p/7628685.html