Java Utility Library

Just the beginning of us open-sourcing the many hours of fine-tunings we have done for efficiently accessing FoundationDB at Wavefront. For those who are using Java, this batch includes our BatchReader and CollectKeyValuesUntilDone helper classes.

BatchReader takes a database and runs just one transaction (meaning just one read version is obtained) for all gets and scans against it, automatically managing transaction lifecycle and enforcing a max TTL. The code is pretty self-explanatory right now but more documentation and tests are expected in coming days.

CollectKeyValuesUntilDone is for folks who don’t care about consistency in scans across large key ranges and just want to run a supplier, an accumulator, and a final transformer over essentially an infinite number of keys (assuming that the accumulator is doing sane things).

Hopefully, they inspire similar libraries for other languages too and this is certainly just the beginning. We’ll eventually be releasing this on sonatype but for now, it’s just the code.

7 Likes

Oh, I forgot to mention that with the BatchReader, we can get consistently single digit milliseconds for random reads and for a lot of API calls that access read-only data, the default max lag of 1s is fine (and if you want write-then-read semantics, you can force a new transaction on the same node). Otherwise, it’s just a quick way to drive down read latencies for single key reads and scans.