-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Change maxuploadtarget recommended minimum calculation #8559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -2193,7 +2193,7 @@ void CNode::RecordBytesSent(uint64_t bytes) | |||
void CNode::SetMaxOutboundTarget(uint64_t limit) | |||
{ | |||
LOCK(cs_totalBytesSent); | |||
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SERIALIZED_SIZE; | |||
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_BASE_SIZE; | |||
nMaxOutboundLimit = limit; | |||
|
|||
if (limit > 0 && limit < recommendedMinimum) |
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.
Nit: Can you also adjust the LogPrintf below to display the size in whatever unit -maxuploadtarget
is.
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.
@MarcoFalke: I can't parse your sentence. :)
Right now we have: LogPrintf("Max outbound target is very small (%s bytes) and will be overshot. Recommended minimum is %s bytes.\n", nMaxOutboundLimit, recommendedMinimum);
which prints the desired output limit (1:1 from -maxuploadtraget
and the recommended minimum, both are stated to be in bytes.
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.
Huh, I thought -maxuploadtarget was in MB or MiB?
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.
Yes. It is in MB. But the LogPrintf does print out the passed in MB values in bytes (nMaxOutboundLimit
is -maxuploadtarget *1024 *1024
)
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.
I think it would be more user friendly to print this out in MiB, so the user can see what value for -maxuploadtarget
should be used instead.
b42a065
to
5e87200
Compare
Changed the recommended minimum "calculation" (it's not really a calculation) from 144 blocks to 72 full blocks (on the wire size) per day. Updated the docs, removed the MiB values. |
Thanks, looks better! utACK 5e872003e7243c4e02eec4f57f3a001dd20d925c |
Feedback from a rather "normal user": In reduce-traffic.md would now be written: In my opinion, this is not understandable for a normal user- what value should that be in MiB ?? I think it would be better to recommend a concrete value in the unit of the parameter (MiB), and adapt that recommendation with increasing population of Segwit (and therefore the increasing ammount of bytes stored in one block, as I understand?) accross the upcoming (minor) releases. At least, if the current text should remain, there should be more explanation of how could one calculate "72 full blocks (by size "on the wire" per day)"" to MiB. |
historic blocks. **The recommended minimum is 144 blocks per day (max. 144MB | ||
per day)** | ||
historic blocks. | ||
**The current recommended minimum is 72 full blocks (by size "on the wire" per day)** |
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.
Nit: (to address the feedback by @wodry )
The current recommended minimum is -maxuploadtarget=$recommendedMinimum
, assuming an average serialized block size of 2MB.
5e87200
to
d2ce6d3
Compare
Nits addressed. |
utACK |
utACK d2ce6d3 |
Instead of |
@wodry The block size limit is denoted in the "decimal" MB (Like most other sizes in Bitcoin Core). Unfortunately some palaces use MiB, but there is nothing you can do about it. |
historic blocks. **The recommended minimum is 144 blocks per day (max. 144MB | ||
per day)** | ||
historic blocks. | ||
**The current recommended minimum is 288MiB, assuming an average serialized block size of 2MB.** |
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.
:%s/288/275 /g
Per
$ src/qt/bitcoin-qt -maxuploadtarget=12 -regtest -printtoconsole|grep Recomm
2016-08-26 19:22:09 Max outbound target is very small (12 MiB) and will be overshot. Recommended minimum is 274.658 MiB.
But consider it a nit. Can be merged now.
There are constantly 144 blocks per day. Segwit blocks can be up to 4 MB. If users set a value lower than this, what happens when that assumption is violated? |
@@ -2193,11 +2193,12 @@ void CNode::RecordBytesSent(uint64_t bytes) | |||
void CNode::SetMaxOutboundTarget(uint64_t limit) | |||
{ | |||
LOCK(cs_totalBytesSent); | |||
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SERIALIZED_SIZE; | |||
// assume the average size of serialized blocks is half the maximum | |||
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SERIALIZED_SIZE / 2; |
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.
Suggest defining MAX_EXPECTED_BLOCK_SIZE somewhere.
@luke-jr IIRC, nothing will happen. You just stop to serve historical blocks earlier. I think you can even set |
uh. so the reason that it is a full day is because that is the reset interval. Since the limiting will not prevent it from sending blocks, the purpose of the minimum was that it was the true minimum, and setting lower would pretty much guarantee overshoot. |
Though, |
So we might as well just remove the "recommended" minimum and call it done. Effectively you are still not helping IBD if you set the target to |
Closing in favor of #8712 |
Addresses #8555.
Changes the recommended
-maxuploadtarget
minimum from 144 blocks per day to 72 blocks per day. With the SWsMAX_BLOCK_SERIALIZED_SIZE
of 4MiB, 144 blocks per day would result in a recommended minimum of 576MiB per day = ~17GB per Month in uploading blocks. IMO this is too hight for a recommended minimum.This PR changes the minimum calculation from 144 to 72 blocks per day ("half day of full blocks").
Anyway, the calculation is just a form of an vague estimation of how many MiB in historical blocks we should recommend to broadcast upstream when
-maxuploadtarget
is set. It does not take -maxconnection etc. into the calculation.The current maxuploadtarget recommendation is calculated usingMAX_BLOCK_SERIALIZED_SIZE
(4MB) instead ofMAX_BLOCK_BASE_SIZE
(1MB). Given that the function is there to reduce uploading historical blocks, usingMAX_BLOCK_BASE_SIZE
makes more sense.