feat(kad): configurable outbound_substreams timeout#6015
feat(kad): configurable outbound_substreams timeout#6015mergify[bot] merged 2 commits intolibp2p:masterfrom
Conversation
5fdd136 to
171b7af
Compare
|
Thank you for the PR @maqi.
|
171b7af to
91f3eff
Compare
Hi, @elenaf9, Thx for the comment and clarification. |
91f3eff to
877b7b4
Compare
ff0435c to
52273cd
Compare
elenaf9
left a comment
There was a problem hiding this comment.
Sorry, one more comment that I missed in the last review. Rest LGTM, thanks!
52273cd to
9735801
Compare
Then testing `put_record_to` with poor connectioin but large packet size (around 4MB), the `put_record_to` frequently got failed and the PutRecordToError::stats showing always failed at 10s.
```
"kad_event::PutRecordError::QuorumFailed", required quorum 2, stored on [], QueryStats { requests: 5, success: 0, failure: 5, start: Some(Instant { tv_sec: 121323, tv_nsec: 961187829 }), end: Some(Instant { tv_sec: 121334, tv_nsec: 188694869 }) } - ProgressStep { count: 1, last: true }
```
However, this timeout is not defined by request/response protocol timeout (which in our case increased to 30s already).
Further digging through the libp2p code, it turned out this timeout is actually affected by outbound_substreams timeout.
We tested with increase to 30s, do see much less put_record_to failure and QueryStats showing extended completion duration (larger than 10s, and in case of failed, to be 30s).
Hence raised this PR to provide a configurable approach of the timeout.
Pull-Request: libp2p#6015.
#6015 made the timeout for outbound substreams in kademlia configurable by introducing a `outbound_substreams_timeout` config option. There is currently an open PR #6009 that plans to also apply that timeout to inbound substream, in which case we probably want toe rename the config option to `substreams_timeout` (without the prefix). Because we plan to release soon and might not get #6009 in in-time, I propose that we already do the renaming now, to avoid breaking the API again with the next release. Pull-Request: #6076.
Description
When testing
put_record_towith poor connectioin but large packet size (around 4MB), theput_record_tofrequently got failed and the PutRecordToError::stats showing always failed at 10s.However, this timeout is not defined by request/response protocol timeout (which in our case increased to 30s already).
Further digging through the libp2p code, it turned out this timeout is actually affected by outbound_substreams timeout.
We tested with increase to 30s, do see much less put_record_to failure and QueryStats showing extended completion duration (larger than 10s, and in case of failed, to be 30s).
Hence raised this PR to provide a configurable approach of the timeout.
Notes & open questions
Ideally, the configurate shall via function call.
However, it seems it will be via the kad::ProtocolConfig , which could having issue of:
Would like a guide if there is other way to do this configure setup more user friendly.
Change checklist