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

Tweak a retry number for piece retrieval operations on DSN L2. #1910

Merged
merged 3 commits into from
Aug 30, 2023

Conversation

shamil-gadelshin
Copy link
Member

This PR tweaks a retry number for piece retrieval operations on L2 cache population.

Code contributor checklist:

 - Move retry number const for piece retrieval to subspace-networking crate.
@shamil-gadelshin shamil-gadelshin added the networking Subspace networking (DSN) label Aug 30, 2023
@shamil-gadelshin shamil-gadelshin self-assigned this Aug 30, 2023
pub use utils::multihash::Multihash;
pub use utils::prometheus::start_prometheus_metrics_server;
pub use utils::unique_record_binary_heap::{KeyWrapper, UniqueRecordBinaryHeap};

/// Get piece retry attempts number.
pub const PIECE_GETTER_RETRY_NUMBER: NonZeroU16 = NonZeroU16::new(3).expect("Not zero; qed");
Copy link
Member

Choose a reason for hiding this comment

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

If you increase number of retries beyond one you can immediately expect me to ask for rationale and explanation why it is necessary and which issues does it fix.

Also I really don't like non-fundamental values as constants, especially public ones.

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean by "non-fundamental values"?

If you increase number of retries beyond one you can immediately expect me to ask for rationale and explanation why it is necessary and which issues does it fix.

We discussed that yesterday, here are key takeaways: dsn cache scan without retries has 1-3% "not found" results on my machine. Setting this value to 3 makes scans 100% successful. I set this value to increase the probability of maintaining a healthy cache across the network. I left piece retrieval on block importing and piece reconstruction with their zero retries because they just retry with different piece indexes. In other cases, it makes sense to use the recommended value. Also, if this value changes - we'll change it in a single place.

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean by "non-fundamental values"?

We have fundamental protocol constants like piece size for instance.

Retries though are not fundamental number and should be a part of dynamic configuration. You can set default to some number, but it should still be a configuration parameter, not a constant exposed on subspace_networking. As such I don't think it should be a single number in a single place.

So does this mean we're making up to 4 attempts to download a piece (initial + 3 retries)?

Copy link
Member

Choose a reason for hiding this comment

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

BTW your last comment is exactly the kind of details I expect to be written in PR description from the beginning. One generic line with zero specifics doesn't cut it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Retries though are not fundamental number and should be a part of dynamic configuration. You can set default to some number, but it should still be a configuration parameter, not a constant exposed on subspace_networking. As such I don't think it should be a single number in a single place.

Ok. I will change it back to crate's local constants.

So does this mean we're making up to 4 attempts to download a piece (initial + 3 retries)?

Yes, in rare cases. In practice, we need at most 2 attempts.

Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

I'm still curious why we don't find it the first time. Does it happen to be invalid perhaps? Because that is possible with farmers that are still running the original release of the software.

@shamil-gadelshin
Copy link
Member Author

I'm still curious why we don't find it the first time. Does it happen to be invalid perhaps? Because that is possible with farmers that are still running the original release of the software.

We didn't change the protocol enough to break these requests. I would guess that is because of either "behind the NAT yet present in Kademlia peers" or a natural churn.

@nazar-pc
Copy link
Member

We didn't change the protocol enough to break these requests.

#1850

Also removal of cuckoo filters broke compatibility with all older clients because cuckoo library panicked internally with zero sized filters.

So I have to disagree, we did broke it.

@shamil-gadelshin
Copy link
Member Author

We didn't change the protocol enough to break these requests.

#1850

Also removal of cuckoo filters broke compatibility with all older clients because cuckoo library panicked internally with zero sized filters.

So I have to disagree, we did broke it.

Hmm, both issues could contribute to the failed requests indeed.

@shamil-gadelshin shamil-gadelshin merged commit f14aba5 into main Aug 30, 2023
9 checks passed
@shamil-gadelshin shamil-gadelshin deleted the set-retries-for-l2-cache-retrieval branch August 30, 2023 14:58
nazar-pc added a commit that referenced this pull request Aug 31, 2023
Tweak a retry number for piece retrieval operations on DSN L2. (#1910)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
networking Subspace networking (DSN)
Projects
Development

Successfully merging this pull request may close these issues.

2 participants