dendrite icon indicating copy to clipboard operation
dendrite copied to clipboard

bundleSize is not a configurable WriterOption

Open lsankar4033 opened this issue 9 years ago • 4 comments

Currently, bundle size is defaulted to 256: https://github.com/jwhitbeck/dendrite/blob/master/dendrite/java-src/dendrite/java/Options.java#L343. If the write thread is outrun by the writing thread, it's possible that the batchQueue gets filled. This is a problem if the machine running dendrite doesn't have enough memory.

Another method to solve this problem might be to apply backpressure via the API (i.e. making certain write calls more expensive when a flush is necessary).

lsankar4033 avatar Dec 16 '15 03:12 lsankar4033

I believe I also have a case where I would want bundle size to be configurable. I am writing out many rows per file to many files, and when I hit ~800 open FileWriters my process OOMs, even with a 20GB heap size. AFAICT the only collection that is growing is the map of FileWriters.

harob avatar Dec 17 '15 05:12 harob

The batchQueue is a BlockingQueue that can't hold more than 10 bundles and will start blocking beyond that. There is no particular reason for this value and we could probably lower that to 1 bundle. This would lower the memory usage in the case where the calling thread outruns the dendrite writing thread and shouldn't have any noticeable write throughput impact. I would rather have a good hardcoded value than expose more internals in the public API. Would that address both of your needs?

jwhitbeck avatar Dec 18 '15 20:12 jwhitbeck

Made the batch queue size change here 7ab029242cf292e28d3ea4aa286f501e2e92ee57

jwhitbeck avatar Dec 19 '15 08:12 jwhitbeck

Fair enough. This covers my issue. If @harob agrees, we can close this out.

lsankar4033 avatar Dec 29 '15 20:12 lsankar4033