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
{{ message }}
Repository navigation
Slow backfilling, while high dist throughput #1885
@wojons noticed that one of his nodes became very slow. It was backfilling from another node, and by looking at ajax/progress, we could see that the backfilling was extremely slow indeed. Took about 30 seconds for a single block.
Writes seemed to get through only sporadically. It would pause for 5 seconds or so, and then process a bunch of (backfill) writes, and then pause again.
At the same time, the slow RethinkDB instance had a relatively steady disk write throughput of ~50 MB/s. CPU usage was higher than I would expect at this kind of throughput, but not maxed out (usually between 20 and 50%).
Restarting the instance didn't change this.
Then @wojons shut down the node, deleted the table file completely, and brought it up again. With the fresh table file, backfilling was back at normal speed (disk throughput was roughly the same, ~60 MB/s).
Also: I checked ajax/stat and there didn't seem to be any active garbage collector judging from the extents_gced stats. However I don't quite trust those perfmons...
I could mostly reproduce this. I can get backfilling which becomes very slow towards the end. I don't see the high disk write throughput though (in fact it is very low, less than 1 MB/s on average).
In my experiments it only happened when the sender of the backfill is on rotational disks, so it doesn't seem to be a problem on the writer's end.
It's well possible that this is simply bounded by random access times on rotational disks (iostat reports ~500 tps on the drive).
Just ran into this, and had a discussion with some of the devs on IRC. My machines have 6-SATA disk hardware RAID5, and it was doing a few thousand TPS, and only doing a few blocks per second. I reduced the table to one shard to try and reduce random IO, but it was still replicating very slowly. I ended up following the advice in this ticket, by removing the table file from the replica and restarting replication. Then it went up to 400-500 sustained writes/sec, and in ~15m has already passed the amount of blocks it completed by running all night previously.
So, I think for people with spinning disks, current best practice should be no more than 1 replica per table per system.
Tried switching my second machine to --no-direct-io, and this seems to have boosted average disk throughput from 20-30 MB/s to 30-40MB/s, which is a pretty reasonable increase. Given how much that seems to help this issue, it would be good to get #1892 fixed.
Talked with @neumino on IRC, this problem has re-occured even after blowing away and re-creating the table on the secondary system. Doing this boosted sync speed initially, but after letting it run overnight, it's mostly stalled again, only doing ~1 msg/sec, even though the syncing machine is still doing ~20MB/s in ~2000 writes/sec.
So something about the sync workload is working extremely hard, but making almost 0 progress.
@nergdron Thanks for chiming in. I belief that this is due to the fact that backfilling causes a lot of random disk seeks in our current implementation. I will analyse that more though.
I'm a little baffled by the behaviour though. Initially, we saw it sync about 60k blocks in about an hour, then 24h later, it was only done about 70k, and after that, it seemed to only completely about 1k per day or less. Looking at the disk IO, the machine which was doing the syncing was still doing a very high rate of IO to disk, it just didn't seem to be making any progress on actually completing the sync. We're at the point now where new data is being pushed into the table faster than it's syncing to the secondary machine, so it's likely impossible for it to ever complete.
This is our first attempt to develop an application against RethinkDB, so we don't have another secondary available, and the system isn't yet production.
@nergdron one thing to check is the disk usage on both the primary on the secondray. I have seen in one bug where the secondray was backfilling but is mark larger then the primary. Also you can stop the master and copy the table file the primary to the secondray and then reboot the nodes and the secondray will be magically synced up with the primary but you have to stop both machines.
Index build rate, according to the web interface, has dropped to about ~500 writes/s, which is a significant decrease in speed. If the speed continues to decline over time, this will push out the index rebuild, perhaps into next week.
@nergdron: building a secondary index in 1.12 might have become a little slower especially on rotational drives. That's because it is throttled more aggressively to make sure it doesn't slow down any ongoing queries. Because of how it works, that throttling has some effect even without other queries going on.
Alright, secondary index rebuilt, testing syncing a second replica to the second node. It's currently working away at ~1k writes/sec according to the web interface.
Unfortunately, after leaving the replication running over the weekend, it's now dropped to a very unstable rate of 50-450 writes/s (centered around 250/s) and is behaving very erratically. After 3 days, it has only completed 747340/2730617 blocks. So, it doesn't appear like this problem is resolved in the latest 1.12 releases.
@wojons It's 6 x 2TB SATA disks in hardware RAID10 with 512MiB BBU write cache, 48GiB of RAM, 2 x E5645 Xeons for each node. The storage is pretty slow at random IO, but reasonably speedy at block IO. It's not SSDs because this is the hardware I had free when I went to set up our test cluster, and because we tend to like to test on underpowered hardware so we can see where things break a little easier. That's definitely what's led to the tickets I've opened, so it feels like the right approach. ;)
@nergdron i totally agree about testing on under powered hardware i built most of my app on a spinning disk cluster. So I was talking with @srh and my best guess before he makes his rolling on this is If you have a super large data set like the one i think i remeber you having is if your index goes out of memory your going to end up paging a lot. When you have just the primary index then your only paging for 1 index but if your have lots of secondray indexes it compands the problem. From what @srh said it could take 4 to 5 block reads to find the right spot in the index to write. and this could express the reason why your times are between 50-450 writes at once when you have a lot of blocks to read then its 50 a sec when u have few its 450. my guess is that its going to keep getting slower and slower. I would suggest that you build just pirmary key and then since indexes can build in the background well now you can let them build one at a time and should be a lot faster. Something you may want to do is have the node read the import file remortly if you have a lot of network badwith it will just lower the random io.
Oh yeah, forgot to mention that my dataset is about 400GB. That doesn't seem crazy huge to me, as it's about what we put on each MySQL shard. Does RethinkDB not take the same approach as InnoDB, and try to keep indexes in RAM ahead of data, to ensure no index related problems occur?
@nergdron from a chat i had with @danielmewes there is no idea of a tier'd cache. Cache is determinted by least used. So if the data chunk was used more recently then an index chunk the index one will be dropped first. but @srh is probably the best person to ask about this.
@nergdron I've been able to reproduce backfill rates of ~250 writes/s on rotational drives. I opened #2392 about it (by changing that value in the code I can get more towards 1K writes/s).
Activity
danielmewes commentedon Jan 20, 2014
Also: I checked ajax/stat and there didn't seem to be any active garbage collector judging from the extents_gced stats. However I don't quite trust those perfmons...
wojons commentedon Jan 20, 2014
I know i should have only done one thing but i also put it into no-direct-io mode
danielmewes commentedon Jan 21, 2014
I will try if I can reproduce this later.
danielmewes commentedon Jan 21, 2014
I could mostly reproduce this. I can get backfilling which becomes very slow towards the end. I don't see the high disk write throughput though (in fact it is very low, less than 1 MB/s on average).
In my experiments it only happened when the sender of the backfill is on rotational disks, so it doesn't seem to be a problem on the writer's end.
It's well possible that this is simply bounded by random access times on rotational disks (iostat reports ~500 tps on the drive).
nergdron commentedon Feb 4, 2014
Just ran into this, and had a discussion with some of the devs on IRC. My machines have 6-SATA disk hardware RAID5, and it was doing a few thousand TPS, and only doing a few blocks per second. I reduced the table to one shard to try and reduce random IO, but it was still replicating very slowly. I ended up following the advice in this ticket, by removing the table file from the replica and restarting replication. Then it went up to 400-500 sustained writes/sec, and in ~15m has already passed the amount of blocks it completed by running all night previously.
So, I think for people with spinning disks, current best practice should be no more than 1 replica per table per system.
nergdron commentedon Feb 4, 2014
Tried switching my second machine to --no-direct-io, and this seems to have boosted average disk throughput from 20-30 MB/s to 30-40MB/s, which is a pretty reasonable increase. Given how much that seems to help this issue, it would be good to get #1892 fixed.
nergdron commentedon Feb 5, 2014
Talked with @neumino on IRC, this problem has re-occured even after blowing away and re-creating the table on the secondary system. Doing this boosted sync speed initially, but after letting it run overnight, it's mostly stalled again, only doing ~1 msg/sec, even though the syncing machine is still doing ~20MB/s in ~2000 writes/sec.
So something about the sync workload is working extremely hard, but making almost 0 progress.
danielmewes commentedon Feb 10, 2014
@nergdron Thanks for chiming in. I belief that this is due to the fact that backfilling causes a lot of random disk seeks in our current implementation. I will analyse that more though.
nergdron commentedon Feb 10, 2014
I'm a little baffled by the behaviour though. Initially, we saw it sync about 60k blocks in about an hour, then 24h later, it was only done about 70k, and after that, it seemed to only completely about 1k per day or less. Looking at the disk IO, the machine which was doing the syncing was still doing a very high rate of IO to disk, it just didn't seem to be making any progress on actually completing the sync. We're at the point now where new data is being pushed into the table faster than it's syncing to the secondary machine, so it's likely impossible for it to ever complete.
wojons commentedon Feb 11, 2014
@nergdron are you using this in a production case?or do you have another secondray avaiable?
nergdron commentedon Feb 11, 2014
This is our first attempt to develop an application against RethinkDB, so we don't have another secondary available, and the system isn't yet production.
wojons commentedon Feb 11, 2014
would u mind joining irc, talk to me there "lexi2"
wojons commentedon Feb 11, 2014
@nergdron one thing to check is the disk usage on both the primary on the secondray. I have seen in one bug where the secondray was backfilling but is mark larger then the primary. Also you can stop the master and copy the table file the primary to the secondray and then reboot the nodes and the secondray will be magically synced up with the primary but you have to stop both machines.
nergdron commentedon Feb 11, 2014
@wojons It's actually a holiday today, but I'll look for you on IRC tomorrow and we can chat about this.
43 remaining items
nergdron commentedon Apr 30, 2014
Index build rate, according to the web interface, has dropped to about ~500 writes/s, which is a significant decrease in speed. If the speed continues to decline over time, this will push out the index rebuild, perhaps into next week.
danielmewes commentedon Apr 30, 2014
@nergdron: building a secondary index in 1.12 might have become a little slower especially on rotational drives. That's because it is throttled more aggressively to make sure it doesn't slow down any ongoing queries. Because of how it works, that throttling has some effect even without other queries going on.
nergdron commentedon May 2, 2014
Alright, secondary index rebuilt, testing syncing a second replica to the second node. It's currently working away at ~1k writes/sec according to the web interface.
nergdron commentedon May 5, 2014
Unfortunately, after leaving the replication running over the weekend, it's now dropped to a very unstable rate of 50-450 writes/s (centered around 250/s) and is behaving very erratically. After 3 days, it has only completed 747340/2730617 blocks. So, it doesn't appear like this problem is resolved in the latest 1.12 releases.
wojons commentedon May 5, 2014
@nergdron what are the specs of the machine again and the size of the data set?
nergdron commentedon May 5, 2014
@wojons It's 6 x 2TB SATA disks in hardware RAID10 with 512MiB BBU write cache, 48GiB of RAM, 2 x E5645 Xeons for each node. The storage is pretty slow at random IO, but reasonably speedy at block IO. It's not SSDs because this is the hardware I had free when I went to set up our test cluster, and because we tend to like to test on underpowered hardware so we can see where things break a little easier. That's definitely what's led to the tickets I've opened, so it feels like the right approach. ;)
wojons commentedon May 5, 2014
@nergdron i totally agree about testing on under powered hardware i built most of my app on a spinning disk cluster. So I was talking with @srh and my best guess before he makes his rolling on this is If you have a super large data set like the one i think i remeber you having is if your index goes out of memory your going to end up paging a lot. When you have just the primary index then your only paging for 1 index but if your have lots of secondray indexes it compands the problem. From what @srh said it could take 4 to 5 block reads to find the right spot in the index to write. and this could express the reason why your times are between 50-450 writes at once when you have a lot of blocks to read then its 50 a sec when u have few its 450. my guess is that its going to keep getting slower and slower. I would suggest that you build just pirmary key and then since indexes can build in the background well now you can let them build one at a time and should be a lot faster. Something you may want to do is have the node read the import file remortly if you have a lot of network badwith it will just lower the random io.
nergdron commentedon May 5, 2014
Oh yeah, forgot to mention that my dataset is about 400GB. That doesn't seem crazy huge to me, as it's about what we put on each MySQL shard. Does RethinkDB not take the same approach as InnoDB, and try to keep indexes in RAM ahead of data, to ensure no index related problems occur?
wojons commentedon May 5, 2014
@nergdron from a chat i had with @danielmewes there is no idea of a tier'd cache. Cache is determinted by least used. So if the data chunk was used more recently then an index chunk the index one will be dropped first. but @srh is probably the best person to ask about this.
coffeemug commentedon May 5, 2014
The approach is very similar to InnoDB, so if things slow down dramatically, there is an issue we'll have to work out.
danielmewes commentedon May 14, 2014
@nergdron I've been able to reproduce backfill rates of ~250 writes/s on rotational drives. I opened #2392 about it (by changing that value in the code I can get more towards 1K writes/s).
danielmewes commentedon May 14, 2014
@nergdron I think what we are seeing now is different from the original problem. I opened issue #2393 to track the progress on the remaining issue.
Closing this, since one major source of slow down during backfills with secondary indexes has been resolved in 1.12.