[srp-client] use proportional jitter for retry timer - #12044
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a proportional jitter to the SRP client's retry mechanism, which is a good improvement to help decorrelate retries from multiple clients. The implementation is correct. I've added one suggestion to make the code for jitter calculation more concise and robust by initializing the variable at declaration.
Library files
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12044 +/- ##
==========================================
+ Coverage 75.88% 77.15% +1.26%
==========================================
Files 667 666 -1
Lines 97424 94615 -2809
==========================================
- Hits 73932 72998 -934
+ Misses 23492 21617 -1875
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
Switch SRP client retry jitter from a fixed value to a proportion of the current retry interval to better decorrelate client retries.
- Introduce kRetryJitterDivisor (1/5) and compute jitter as retry_interval / kRetryJitterDivisor, with a minimum clamp to kRetryIntervalJitter.
- Apply the computed jitter in mTimer.Start(Random::NonCrypto::AddJitter(...)).
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/core/net/srp_client.hpp | Adds kRetryJitterDivisor constant to control proportional jitter. |
| src/core/net/srp_client.cpp | Computes jitter proportionally to current retry interval and uses it when starting the retry timer. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This change updates the jitter calculation for the SRP client's retry mechanism. Previously, a fixed jitter value was used. This could lead to synchronized retries from multiple clients, especially as the retry interval grows. The new implementation calculates the jitter as a fraction of the current retry interval (1/5th), ensuring that the jitter scales with the wait time. This helps to better decorrelate retries from different clients. A new constant `kRetryJitterDivisor` is introduced for this calculation. The jitter is clamped to a minimum value given by `kRetryIntervalJitter`.
2be323c to
301c7cb
Compare
This change updates the jitter calculation for the SRP client's retry mechanism.
Previously, a fixed jitter value was used. This could lead to synchronized retries from multiple clients, especially as the retry interval grows.
The new implementation calculates the jitter as a fraction of the current retry interval (1/5th), ensuring that the jitter scales with the wait time. This helps to better decorrelate retries from different clients.
A new constant
kRetryJitterDivisoris introduced for this calculation. The jitter is clamped to a minimum value given bykRetryIntervalJitter.