Does page lockers make performance low or high?
673154Dec 1 2008 — edited Dec 3 2008I find that if I use bdb page lockers, the performance is lowered. If I use up-level locker which is above pager locker, the performance is higher. Here up-level locker is my own locker not bdb page locker, and it will lock the whole db when there is a writing. The following is my test:
db setttings:
==========
os: linux 2.6.16, single cpu, 1G memeory
db version 4.7.25;
configure enable-cxx enable-posixmutexes enable-pthread_api with-mutex=x86/gcc-assembly
no replicaiton; no second db;
db_type: BTree; db_open_flags: DB_AUTO_COMMIT
env_flag: DB_CREATE | DB_RECOVER | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN | DB_THREAD | DB_INIT_MPOOL
cachesize: 128M
page_size: 8K
m_env->set_lg_bsize(32*1024);
m_env->set_flags(DB_TXN_NOSYNC, 1);
m_env->mutex_set_tas_spins(200);
m_env->set_lk_max_lockers(20000);
m_env->set_lk_max_objects(20000);
m_env->set_lk_max_locks(20000);
m_env->set_tx_max(10000);
I have 100 threads and every thread writes one record to db1 and db2 for 1000 times, so totally there are 100*2*1000=200,000 times of writing.
Test result:
if there is no up-level locker before db->put():
totol time is 33 seconds, and the times of one_record_writing which costs more than 0.05 second is 5571;
if there is a up-level locker before db->put():
totol time is 19 seconds, and the times of one_record_writing which costs more than 0.05 second is 14;
I wonder why the performance is lower if there is no up-level locker before db->put()?
Could you please help me have a look? Thanks.
Edited by: user10665284 on 2008-12-1 上午12:18