What is the best way to use berkeley DB (bdb) handles in a multi-threaded application?
Is it better to have each thread open its own handle; or,
is it better to open a single handle and have each thread do txn_begin { } txn->commit()?
Which one scales better? I am using Transactional Data Store with DB_THREAD flag.
Thanks
Berkeley DB library is thread safe, the SQL API uses TDS (transactional data store), you are free to use any variety of threads (BDB is thread agnostic) or multiple processes accessing the database concurrently. Berkeley DB will manage locking, serialization, and other issues for you.
Berkeley DB is an Open Source embedded database library that provides scalable, high-performance, transaction-protected data management services to applications. Berkeley DB provides a simple function-call API for data access and management.
One feature of some operating systems is the ability to run several threads of execution within a single process. This allows an application to handle asynchronous events, and makes it easier to create event-driven applications without resorting to polling schemes.
All Db2 database system applications are multithreaded by default, and are capable of using multiple contexts. You can use the following Db2 APIs to use multiple contexts.
Did you read this guide to bdb under multi thread environment ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With