-
-
Notifications
You must be signed in to change notification settings - Fork 267
write stream redo using batch-write-stream #165
Conversation
Quick update: here are the results of the old benchmarks I had, now with the new code: (backported this latest back to level-writestream for ease of running with and without my changes without switching branches): Inserting 1M records in chunks of 1000 using a high-watermark of 4000 and a max of 4 concurrent batches:
So the performance gains appear to be maintained in this version on my dev machine. Would appreciate that someone contributed with his run of these plain benchmarks. |
hmm, so if we want to get rid of magic numbers, then we can look for algorithms that support a range of inputs. |
Quick update on benchmarks: reran benchmark suite, here are the results: |
Been thinking about this, and I think, just like the Anyway, this implementation looks faster for most cases I've run and passes all the tests, feel free to merge it. |
I'd like to have a quick look at this before we release it but I'm travelling over the next 2 days. Will try and have a peek soon and then we can release and see how it goes in the wild! |
db.once('ready', ready) | ||
this.once('finish', onFinish.bind(this)) | ||
|
||
BatchWriteStream.call(this, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be best to just xtend(options, { objectMode: true })
here to save a few lines, unless we're trying to avoid passing something on?
Fstream stuff can be removed from the tests. Including the functional tests and the dependencies that go along with them. |
tried runnign this and get a couple of errors in the tests, some stream errors and this:
|
what what waht??? which version of Node is this.. there was a problem with Arrays this size in the V8 that shipped with 0.11.3 but it's fixed before and after that. |
oh, was using 0.11.6 |
I tried this WriteStream in LevelGraph, and it gave me a 30%+ improvement, so I'm definitely 👍 for this to get in. |
Makes no sense anymore since writestream is getting pulled out. |
For discussion:
Rewrote write_stream based on batch-write-stream.
(Unfortunately I can't extend
readable-stream.Writable
or stream.Writable to make it write in batches)Benchmarks
Running the existing stream benchmark locally yielded very similar results to writestream-rewrite:
write-stream-optimization-benchmark-fix branch:
writestream-rewrite branch:
Still have to rerun a set of benchmarks I have and update the results page.
Magic values
All the magic values are in options:
These default values were empirically set: they simply were the values that yielded the most local performance.
As said, will rerun some benchmarks to extract some more significant numbers from this version.
My feeling is that if we want to optimize, as @dominictarr hinted, that must be done in run-time, since the numbers we'll extract will only be relevant in the local system for the
db.copy
pattern.