deephacks / lmdbjni

LMDB for Java
Apache License 2.0
204 stars 28 forks source link

Performance Questions #26

Closed darkone23 closed 9 years ago

darkone23 commented 9 years ago

Hi,

Thanks for creating this fork, it seems to be more active than the original.

I have been trying to use this for a simple disk backed queue and found that the performance was much worse when compared to the project it is a fork of. I have been using the original project with some success.

In my project's tests I have a case with 300 appends and then 300 reads and deletes (stack push/pop) and when using the leveldb facade over https://github.com/chirino/lmdbjni it takes under a second, while the same test takes 25 seconds using this library. I am even using the BufferCursor for reads and writes, why would something like 300 writes, 300 reads, and 300 deletes take 25 seconds using this project?

I did some simple profiling with yourkit and it looks like all the time is spent inside of the JNI call to the txn commit, here: https://github.com/deephacks/lmdbjni/blob/master/lmdbjni/src/main/java/org/fusesource/lmdbjni/JNI.java#L476

Any help would be appreciated,

Thanks, Thomas

phraktle commented 9 years ago

Hi Thomas,

Can you provide an example code to reproduce this? What platform are you running on?

Thanks, Viktor

krisskross commented 9 years ago

As I recall we haven't modified the write path much so the performance should be same as the original fork. Do you have a test case and so I can reproduce?

darkone23 commented 9 years ago

I'll try to provide a simple side by side test case this weekend.

krisskross commented 9 years ago

Did you find the underlying cause of the performance penalty or is it still a problem?

darkone23 commented 9 years ago

@phraktle - @krisskross - Thanks for the quick follow up.

After a bit more digging I realized this was the way I had configured LMDB across projects.

I was using the leveldb facade provided in the original and it sets certain options like NOMETASYNC.

d'oh!

Thanks again!

krisskross commented 9 years ago

Good to hear. Thanks for letting us know.