Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Berkeley DB in multithreaded applications

What is the best way to use berkeley DB (bdb) handles in a multi-threaded application?

  1. Is it better to have each thread open its own handle; or,

  2. 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

like image 300
psaccounts Avatar asked Dec 05 '09 01:12

psaccounts


People also ask

Is Berkeley DB thread safe?

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.

What is Berkeley DB used for?

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.

What is multi-threaded database?

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.

Are databases multithreaded?

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.


1 Answers

Did you read this guide to bdb under multi thread environment ?

like image 100
Vadym Stetsiak Avatar answered Sep 22 '22 17:09

Vadym Stetsiak