Skip to content
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

src: dynamic block sync size #9494

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0xFFFC0000
Copy link
Collaborator

No description provided.

@0xFFFC0000
Copy link
Collaborator Author

Same content. Only removed white-space changes.

Copy link
Contributor

@sneurlax sneurlax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! It was helpful for me to start reviewing out from here

Copy link
Contributor

@nahuhh nahuhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on stressnet and mainnet

@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/dynamic-bss branch from 2ce35d9 to 03d0dce Compare October 12, 2024 06:36
@0xFFFC0000
Copy link
Collaborator Author

All comments have been addressed. Once discussion finished, I will update release branch too.

@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/dynamic-bss branch from 03d0dce to 2195b6a Compare October 13, 2024 12:37
@0xFFFC0000
Copy link
Collaborator Author

Updated to most latest master branch commit : 9866a0e9021e2422d8055731a586083eb5e2be67.

Co-authored-by: nahuhh
@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/dynamic-bss branch from 2195b6a to 5459934 Compare February 5, 2025 14:53
@0xFFFC0000
Copy link
Collaborator Author

Rebased to updated master. Now CI should run without any issue.

MINFO("Last " << number_of_blocks
<< " blocks median size is " << median_weight
<< " bytes and the max average blocksize in the queue is " << average_blocksize_of_biggest_batch << " bytes");
uint64_t projected_blocksize = (average_blocksize_of_biggest_batch > median_weight) ? average_blocksize_of_biggest_batch : median_weight;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uint64_t projected_blocksize = (average_blocksize_of_biggest_batch > median_weight) ? average_blocksize_of_biggest_batch : median_weight;
uint64_t projected_blocksize = (average_blocksize_of_biggest_batch > median_weight) ? average_blocksize_of_biggest_batch : median_weight;
uint64_t blocks_huge_threshold = (batch_max_weight / 2);

Comment on lines 1252 to 1258
else if (projected_blocksize >= batch_max_weight) {
res = 1;
MINFO("blocks are projected to surpass " << batch_max_weight << " bytes, syncing just a single block in next batch");
}
else if (projected_blocksize > BLOCKS_HUGE_THRESHOLD_SIZE) {
res = 1;
MINFO("blocks are huge, sync just a single block in next batch");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
else if (projected_blocksize >= batch_max_weight) {
res = 1;
MINFO("blocks are projected to surpass " << batch_max_weight << " bytes, syncing just a single block in next batch");
}
else if (projected_blocksize > BLOCKS_HUGE_THRESHOLD_SIZE) {
res = 1;
MINFO("blocks are huge, sync just a single block in next batch");
else if (projected_blocksize >= blocks_huge_threshold) {
res = 1;
MINFO("blocks are projected to surpass 50% of " << batch_max_weight << " bytes, syncing just a single block in next batch");
}

condense

#define BLOCKS_MEDIAN_WINDOW 100 //by default, compute median weights of last 100 blocks
#define BATCH_MAX_WEIGHT 20 //by default, maximum size of batch in [mB]
#define BATCH_MAX_ALLOWED_WEIGHT 50 //maximum allowed size of batch in [mB]
#define BLOCKS_HUGE_THRESHOLD_SIZE ((BATCH_MAX_WEIGHT * 1000000) / 2) //blocks that we consider huge [B]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define BLOCKS_HUGE_THRESHOLD_SIZE ((BATCH_MAX_WEIGHT * 1000000) / 2) //blocks that we consider huge [B]

swapped here
#9494 (comment)

@@ -98,6 +98,10 @@
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4 100 //by default, blocks count in blocks downloading
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 20 //by default, blocks count in blocks downloading
#define BLOCKS_SYNCHRONIZING_MAX_COUNT 2048 //must be a power of 2, greater than 128, equal to SEEDHASH_EPOCH_BLOCKS
#define BLOCKS_MEDIAN_WINDOW 100 //by default, compute median weights of last 100 blocks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define BLOCKS_MEDIAN_WINDOW 100 //by default, compute median weights of last 100 blocks
#define BLOCKS_MEDIAN_WINDOW CRYPTONOTE_REWARD_BLOCKS_WINDOW //by default, compute median weights of last 100 blocks (CRYPTONOTE_REWARD_BLOCKS_WINDOW)

@@ -112,6 +113,15 @@ namespace cryptonote
void log_connections();
std::list<connection_info> get_connections();
const block_queue &get_block_queue() const { return m_block_queue; }
const std::uint64_t max_average_of_blocksize_in_queue() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const std::uint64_t max_average_of_blocksize_in_queue() {
std::uint64_t max_average_of_blocksize_in_queue() {

Warning in build log

@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/dynamic-bss branch 3 times, most recently from 6315667 to 03bcd6f Compare February 24, 2025 05:39
Co-authored-by: nahuhh
@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/dynamic-bss branch from 03bcd6f to fd06f00 Compare February 24, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants