Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Strange delay when committing transactions

Dimokritos StamatakisMar 4 2017 — edited Mar 13 2017

Hi all,

I am experiencing a strange behavior when committing transactions and I am suspecting it has to do with the group commit policy of BDB.

Here is a sample code (for simplicity I assume "mytable_"+i is the concatenation of "mytable_" and variable i):

DB_ENV* dbenv;

DB* dbp;

DB_TXN* tid;

int i;

u_int32_t env_flags = DB_PRIVATE | DB_CREATE | DB_RECOVER | DB_THREAD | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN;

db_env_create(dbenv, 0)

dbenv->open(dbenv, BDB_HOME, env_flags, 0664);

dbenv->txn_begin(dbenv, NULL, &tid, 0);

for( i=1; i<20; i++) {

 db\_create(&dbp, dbenv, 0);

 dbp->open(dbp, tid, DB\_FILE\_NAME, "mytable\_"+i, DB\_BTREE, DB\_MULTIVERSION | DB\_THREAD, 0664);

 tid->commit(tid, 0);   (\*\*)

 dbp->close(dbp, 0);

 sleep(1);

 dbenv->txn\_begin(dbenv, NULL, &tid, 0);

}

tid->commit(tid, 0);

dbenv->close(dbenv, 0);

I am doing more operations after creating each table, but I omit them for simplicity.

The problem is that the commit marked in (**) takes long time to complete when I have the sleep(1).

Without the sleep(1), commit only takes 200usec and with the sleep(1) it takes 300ms!

I suspect that it has to do with the group commit of BDB. When having the sleep, it probably waits for more commits before it flushes to disk, that's why it takes much more time for the commit to finish. Is there a way to tune BDB so that to avoid this behavior?

Here is a graph showing how the commit time changes when we change the sleep time. When going from 700ms to 800ms we see a huge difference in the time commit takes to complete.

delay.png

Thanks,

Dimos

This post has been answered by userBDBDMS-Oracle on Mar 8 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 10 2017
Added on Mar 4 2017
14 comments
2,260 views