Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSync bug fixes #1002
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukechampine
Mar 1, 2016
Member
neat. I have no comments as the changes are all pretty simple. David may have concerns about the tests though.
This might reduce load on the explorer, so we'll want to update that binary as soon as this is merged.
|
neat. I have no comments as the changes are all pretty simple. David may have concerns about the tests though. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
VoidingWarranties
Mar 1, 2016
Collaborator
Unfortunately the explorer won't benefit until its peers are also using this version of SendBlocks.
The explorer will won't fully benefit until its peers are also using this version of SendBlocks. It should hopefully reduce the load at least a little.
|
|
DavidVorick
reviewed
Mar 1, 2016
| @@ -176,6 +176,7 @@ func (cs *ConsensusSet) sendBlocks(conn modules.PeerConn) error { | ||
| found = true | ||
| // Start from the child of the common block. | ||
| start = pb.Height + 1 | ||
| break |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
DavidVorick
Mar 1, 2016
Member
how many gigabytes do you think this bug has eaten? I'm going to guess 25,000.
DavidVorick
Mar 1, 2016
Member
how many gigabytes do you think this bug has eaten? I'm going to guess 25,000.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
VoidingWarranties
Mar 1, 2016
Collaborator
Let's assume an average block size of 100kB, with an average network size of 100 peers. There are ~40,000 blocks. Let's also assume constant block size and number of peers.
100kB * 100 peers * sum of integers from 0 to 40,000 ~= 8PB
Wow. Did I get my math wrong?
VoidingWarranties
Mar 1, 2016
Collaborator
Let's assume an average block size of 100kB, with an average network size of 100 peers. There are ~40,000 blocks. Let's also assume constant block size and number of peers.
100kB * 100 peers * sum of integers from 0 to 40,000 ~= 8PB
Wow. Did I get my math wrong?
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
DavidVorick
Mar 2, 2016
Member
yes you did :)
Average peer has about 10 friends during IBD. Each peer does IBD probably, once, though total we've probably done 10,000 IBDs. Assuming that they're downloading 35,000 blocks on average, and they catch up from block 0, and I know that blocks don't average 100kb, probably closer to 10kb (especially the early blocks are mostly empty). I think the size of the whole blockchain is around 500MB.
500MB * 10 peers * 10,000 IBDs is 50,000GB. But, that's not where the bug comes in. The bug happens because when there's a new block you ask all 10 peers for their blocks again, and they send them to you from height 0. So assuming it takes 3 hours to IBD, that's 18 blocks. So you download the entire consensus set as much as 180 times. Though really, these connections fail a lot so you probably get cut off.
So, somewhere between 50TB and 500TB, though I'm going to go ahead and expand that number because we did a lot of assuming. So, between 10TB and 1PB.
DavidVorick
Mar 2, 2016
Member
yes you did :)
Average peer has about 10 friends during IBD. Each peer does IBD probably, once, though total we've probably done 10,000 IBDs. Assuming that they're downloading 35,000 blocks on average, and they catch up from block 0, and I know that blocks don't average 100kb, probably closer to 10kb (especially the early blocks are mostly empty). I think the size of the whole blockchain is around 500MB.
500MB * 10 peers * 10,000 IBDs is 50,000GB. But, that's not where the bug comes in. The bug happens because when there's a new block you ask all 10 peers for their blocks again, and they send them to you from height 0. So assuming it takes 3 hours to IBD, that's 18 blocks. So you download the entire consensus set as much as 180 times. Though really, these connections fail a lot so you probably get cut off.
So, somewhere between 50TB and 500TB, though I'm going to go ahead and expand that number because we did a lot of assuming. So, between 10TB and 1PB.
DavidVorick
reviewed
Mar 1, 2016
| // TestRPCSendBlockSendsOnlyNecessaryBlocks tests that the SendBlocks RPC only | ||
| // sends blocks that the caller does not have and that are part of the longest | ||
| // chain. | ||
| func TestRPCSendBlockSendsOnlyNecessaryBlocks(t *testing.T) { |
VoidingWarranties commentedMar 1, 2016
This PR fixes 2 major and 1 minor bugs.
Major bugs:
TestRPCSendBlockSendsOnlyNecessaryBlocks)TestRPCSendBlocks)Minor bug:
This should dramatically improve syncing performance.