You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.4. reportedly has an order of magnitude slowdown on inserts. We should figure out what's going on here pre-release, as this is too big a regression to ignore.
There is also a question of the web ui being inaccessible during batch inserts. This is a) bad from the UX perspective, b) hints that we block somewhere where we shouldn't, c) might give a hint as to what's wrong.
Running simultaneously 10 times the script /home/michel/rethinkdb/fuzzer/clean/build/fuzzer-write*.js
1.4
130 writes/sec
1.3.2
250 writes/sec
Running simultaneously 10 times the script /home/michel/rethinkdb/fuzzer/clean/build/fuzzer-write*.js
Both reach the limits of write/sec before the 10th instance.
The results on the web interface don't seem to be misreported. I checked the time on my script. Here's what I get using the JS driver, one thread, 100 connections.
For 1.4
12 Mar 19:31:16 - 77.307s for 10000 inserts (129 writes/sec)
For 1.3
12 Mar 19:36:38 - 42.966s for 10000 inserts (238 writes/sec)
It's very, very strange that we only get 12 writes/second (vs. 300/second with the old code) on HDDs. I can't think of what changes to the query language would make HDDs in particular drastically slower. Does anybody have any ideas?
I have vague memories of hearing the word fsync with regard to changes at some point; could that be related?
I have a table with 10K documents.
I pull 2000 documents from them, then do some random get, using one thread, 100 connections (using /home/michel/fuzzer/clean/buikd/fuzzer-read*.js
Here's what I get
1.4
260 reads/sec
1.3.2
680 reads/sec
I'll merge all the files and clean my code. But we have a rough idea of the numbers now.
Is the performance drop only when inserting into a fresh database or does it still remain after a while of inserts?
The reason this might be important: If fsync is involved, that would presumably stall the serializer thread (which might stall the webserver / web UI too?). However - assuming direct i/o - fsync should (?) only be called when resizing the database files, which will happen quite frequently in the beginning, but rarely once the database has reached a certain size. Correct?
PS: Here's a change to the syncing. It seems though that the only change on Linux is to now actually check the return code of fsync and to possibly call it again in a loop if it was interrupted. 6405773#src/arch/io/disk.cc
Also there is this which I guess should only affect OS X at all: 8facc79#src/arch/io/disk/pool.cc
If I look at the number of i/o transactions per second (tps) as reported by iostat, it seems that RethinkDB 1.3.2 uses pretty much exactly 3 transactions for each insert (using a single connection). On my machine, I get a rather stable 25 inserts per second, and iostat shows about 75 tps.
RethinkDB 1.4 (as compiled from next) on the other hand, achieves roughly 22 inserts per second with a single connection. The i/o transactions apparently required for this are varying between 100 and more than 300, with an average of about 250 tps. This would correspond to roughly 10 tps per insert.
The write throughputs reported by iostat are on average ~0.3 MB/s for 1.3 and ~1.0 MB/s for 1.4.
Interestingly, after I inserted a lot of documents into 1.4 (using 128) clients, then shut down the server, and restarted it afterwards, iostat now shows the same 75 tps at 25 inserts per seconds as for 1.3. I couldn't test yet whether this was related to the restart of the server, or the high number of documents inserted earlier.
So testing on newton (SSD), I don't see any discernable difference in number of writes between versions 1.4 and 1.3.2. Using a fresh data directory each time, I ran the stress client for ~20000 inserts using either one or many clients, then checked the perfmon stats for the RDB serializer. The relevant stats should be serializer_data_blocks_written and serializer_block_writes, which were very close between the two versions for all scenarios I tried. As expected, higher number of clients (higher throughput), resulted in less writes for both versions.
One unexpected behavior I noticed was that the server would start out with slightly low performance, which would get better after doing some inserts, stopping the stress client and restarting it in a few seconds. This happened on both 1.4 and 1.3.2. This temporary drop in throughput was observed to be caused by garbage collection getting too far being the targeted garbage ratio, and changing garbage collection to high-priority.
Oops. Looks like I had forgotten to clean the data directory for the 1.3 test. With clean ones, there still seems to be a difference in i/o tps, but only at the beginning (and I have not tested this very thoroughly).Sorry for causing confusion.
@srh -- what's the state of this issue? Will it make it into sprint-2 by Friday? (I know it's on the queue behind #207, but I'd like to know how much is left to do here and make sure we can get it into the sprint)
The current state of the code is that the review is updated with the new version of the code that holds partial batches in memory for a while the way everybody else wanted. The main question is that of the merge of secondary indexes with batched inserts, and the exact way to write the code which updates secondary indexes. I'll need to talk about that with Joe, and it looks like that could cause about 1-2 hours of programming. I'm fairly confident the code could be done review by the end of Friday, depending on that and anything else that might go wrong.
Activity
coffeemug commentedon Mar 13, 2013
@neumino is running some benchmarks now, so assigning to him.
neumino commentedon Mar 13, 2013
Using one connection, and inserting 100 documents multiple times (using the data explorer)
Results on SSD
Results on HDD
That should provide a rough idea about the loss of performance.
I'll port my script to 1.3.2 and see what's happening with a more precise workload and multiple connections.
I'll test reads at the same too.
mlucy commentedon Mar 13, 2013
What's the difference between the two "Results on SSD"?
neumino commentedon Mar 13, 2013
Sorry the second one was on HDD.
just edited my previous comment.
neumino commentedon Mar 13, 2013
So the previous tests were run in debug mode. I just tried to build in release mode, and I still get a dozen of write per second on an hdd.
coffeemug commentedon Mar 13, 2013
There is also a question of the web ui being inaccessible during batch inserts. This is a) bad from the UX perspective, b) hints that we block somewhere where we shouldn't, c) might give a hint as to what's wrong.
neumino commentedon Mar 13, 2013
Running simultaneously 10 times the script
/home/michel/rethinkdb/fuzzer/clean/build/fuzzer-write*.jsRunning simultaneously 10 times the script
/home/michel/rethinkdb/fuzzer/clean/build/fuzzer-write*.jsBoth reach the limits of write/sec before the 10th instance.
neumino commentedon Mar 13, 2013
I'll check how many insert were done in my script.
I'll check the reads too.
neumino commentedon Mar 13, 2013
The results on the web interface don't seem to be misreported. I checked the time on my script. Here's what I get using the JS driver, one thread, 100 connections.
For 1.4
For 1.3
mlucy commentedon Mar 13, 2013
It's very, very strange that we only get 12 writes/second (vs. 300/second with the old code) on HDDs. I can't think of what changes to the query language would make HDDs in particular drastically slower. Does anybody have any ideas?
I have vague memories of hearing the word
fsyncwith regard to changes at some point; could that be related?neumino commentedon Mar 13, 2013
I have a table with 10K documents.
I pull 2000 documents from them, then do some random get, using one thread, 100 connections (using
/home/michel/fuzzer/clean/buikd/fuzzer-read*.jsHere's what I get
I'll merge all the files and clean my code. But we have a rough idea of the numbers now.
coffeemug commentedon Mar 13, 2013
Welcome to the wonderful world of performance profiling.
danielmewes commentedon Mar 13, 2013
Is the performance drop only when inserting into a fresh database or does it still remain after a while of inserts?
The reason this might be important: If fsync is involved, that would presumably stall the serializer thread (which might stall the webserver / web UI too?). However - assuming direct i/o - fsync should (?) only be called when resizing the database files, which will happen quite frequently in the beginning, but rarely once the database has reached a certain size. Correct?
PS: Here's a change to the syncing. It seems though that the only change on Linux is to now actually check the return code of fsync and to possibly call it again in a loop if it was interrupted.
6405773#src/arch/io/disk.cc
Also there is this which I guess should only affect OS X at all: 8facc79#src/arch/io/disk/pool.cc
3 remaining items
coffeemug commentedon Mar 14, 2013
@srh -- ok, everything else is done. We all depend on you!
danielmewes commentedon Mar 14, 2013
If I look at the number of i/o transactions per second (tps) as reported by iostat, it seems that RethinkDB 1.3.2 uses pretty much exactly 3 transactions for each insert (using a single connection). On my machine, I get a rather stable 25 inserts per second, and iostat shows about 75 tps.
RethinkDB 1.4 (as compiled from next) on the other hand, achieves roughly 22 inserts per second with a single connection. The i/o transactions apparently required for this are varying between 100 and more than 300, with an average of about 250 tps. This would correspond to roughly 10 tps per insert.
The write throughputs reported by iostat are on average ~0.3 MB/s for 1.3 and ~1.0 MB/s for 1.4.
Interestingly, after I inserted a lot of documents into 1.4 (using 128) clients, then shut down the server, and restarted it afterwards, iostat now shows the same 75 tps at 25 inserts per seconds as for 1.3. I couldn't test yet whether this was related to the restart of the server, or the high number of documents inserted earlier.
Maybe this will help to hunt down the problem...
Tryneus commentedon Mar 15, 2013
So testing on newton (SSD), I don't see any discernable difference in number of writes between versions 1.4 and 1.3.2. Using a fresh data directory each time, I ran the stress client for ~20000 inserts using either one or many clients, then checked the perfmon stats for the RDB serializer. The relevant stats should be serializer_data_blocks_written and serializer_block_writes, which were very close between the two versions for all scenarios I tried. As expected, higher number of clients (higher throughput), resulted in less writes for both versions.
One unexpected behavior I noticed was that the server would start out with slightly low performance, which would get better after doing some inserts, stopping the stress client and restarting it in a few seconds. This happened on both 1.4 and 1.3.2. This temporary drop in throughput was observed to be caused by garbage collection getting too far being the targeted garbage ratio, and changing garbage collection to high-priority.
danielmewes commentedon Mar 15, 2013
Oops. Looks like I had forgotten to clean the data directory for the 1.3 test. With clean ones, there still seems to be a difference in i/o tps, but only at the beginning (and I have not tested this very thoroughly).Sorry for causing confusion.
mglukhovsky commentedon Mar 15, 2013
Moving to 1.5 since this isn't going to make it in.
coffeemug commentedon Mar 18, 2013
Moving to 1.4.x (not that we have 1.4.x for point releases).
srh commentedon Mar 18, 2013
Batched inserts implementation is present in branch sam_457_sans_libcxx, with a review in code review 269.
coffeemug commentedon Apr 1, 2013
An update on the state of this issue -- once
1.5-sprint-1is closed, we'll get on this. It's pretty close to completion.coffeemug commentedon Apr 3, 2013
This is too big and it's too late for point release. Moving to 1.5-sprint-2.
coffeemug commentedon Apr 8, 2013
@srh -- what's the state of this issue? Will it make it into sprint-2 by Friday? (I know it's on the queue behind #207, but I'd like to know how much is left to do here and make sure we can get it into the sprint)
srh commentedon Apr 10, 2013
The state of this bug is unchanged from before. I'd estimate < 1 day of work, which doesn't mean one day of latency as it goes through code review.
srh commentedon Apr 11, 2013
The current state of the code is that the review is updated with the new version of the code that holds partial batches in memory for a while the way everybody else wanted. The main question is that of the merge of secondary indexes with batched inserts, and the exact way to write the code which updates secondary indexes. I'll need to talk about that with Joe, and it looks like that could cause about 1-2 hours of programming. I'm fairly confident the code could be done review by the end of Friday, depending on that and anything else that might go wrong.
srh commentedon Apr 12, 2013
In next as of dbf2f6a
coffeemug commentedon Apr 13, 2013
FYI, this does indeed appear to speed up batched writes by a huge factor:
Not a very rigorous test, but it's a start :) Congrats, @srh and everyone!