« Berkeley DB Java Edition Cleaner and Checkpointer Notes | Main | Berkeley DB Java Edition High Availability Beta »

Berkeley DB Java Edition HA vs Gathering Writes

While working on performance measurement and improvements for JE High Availability (HA) we noticed that we could eliminate a buffer copy by using a gathering write. The changes were simple enough but when I made them, weird things started happening with the stress test I was using. It seemed like the ByteBuffers which were supposedly being sent from master to replica were ending up corrupted over when they got to the replica side. Eventually, we decided that bug 6812202 was responsible (even though we didn't always see an OOME) and in fact, moving to the JDK 1.7 "fixes" the problem. Unfortunately, we are not in a position to pre-req Java 7 for HA or JE for that matter.

You're probably wondering if this means that HA is imminent. Yes, the beta is expected to start in a few weeks, which is a very exciting development for JE. And you may be wondering what we know about HA performance. I'll just say that we're quite comfortable with where HA performance is right now. We know of some areas where we can make improvements and we'll eventually make them, but for now, we like what we see.

Comments (3)

I filed bug 6812202 and also exchanged some e-mails with sun concerning "gathering write".
You say you "could eliminate a buffer copy by using a gathering write" - but you will only eliminate the copy if your are already operating on direct buffers. If not the copy will occur in the implementation of the gathering write (in jdk7 since b50) In earlier versions you may get the OOM - or the size of the process (not heap memory) will blow up.
Regards, Peter

Update: A quote from Alan Bateman and Jeanfrancois Arcand from their talk "Asynchronous I/O Tricks
and Tips" on JavaOne this year

"Scattered ByteBuffer write operations still offer you
free copy, using direct ByteBuffer or not!"

(on slide 40, http://www28.cplan.com/cb_export/PS_TS-4222_304222_230-1_FIN_v1.pdf, login is contentbuilder/doc789)

And don't be misguided by the word "free".

Thanks for the pointers Peter. I should point out that even though the gathering writes may still be copying, the work we were doing was to eliminate a copy in our own code. So the net result would still be one less copy.

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 June 3, 2009 9:15 AM.

The previous post in this blog was Berkeley DB Java Edition Cleaner and Checkpointer Notes.

The next post in this blog is Berkeley DB Java Edition High Availability Beta.

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

Top Tags

Powered by
Movable Type and Oracle