« JE and 64b JVMs (Repost from 11/30/05 Sleepycat blog) | Main | Unsorted Retrieval in JE (Repost from 11/10/05 Sleepycat blog) »

Private vs Shared Database Handles in JE (repost from 11/17/05 Sleepycat blog entry)

[reposted from the 11/17/05 Sleepycat blog entry]

I was recently tuning a benchmark that has lots of threads doing retrievals against JE. The code used a single Database handle shared across all threads. This turned out to present a minor bottleneck because the Database handle maintains a set of Cursors open against it. This set is used to check if all Cursors are closed against the Database when close() is called, but to do that we have to synchronize against it before updating it. So if a bunch of threads are sharing the same Database handle it makes for a synchronization bottleneck.

The moral of the story is that in a multi-threaded case, unless there's a good reason to share a Database handle, it's probably better to use separate handles for each thread.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on September 22, 2006 1:42 PM.

The previous post in this blog was JE and 64b JVMs (Repost from 11/30/05 Sleepycat blog).

The next post in this blog is Unsorted Retrieval in JE (Repost from 11/10/05 Sleepycat blog).

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle