[filebeat][streaming] - Improved websocket exponential backoff logic to produce a smoother backoff curve#44069
Conversation
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
efd6
left a comment
There was a problem hiding this comment.
This seems ok, but is it solving a non-aesthetics problem?
So this is purely an optimisation to the existing growth curve that was present. The existing logic is functional and works well but I personally find that it's a bit too harsh in the way it reaches the wait max cap after just 1-2 attempts. The uncapped jitter is the issue. I think i can make the jitter grow more steadily instead of the calculation being done right now. Would that align more with what you would expect ? |
OK, so I'm wondering what the objective function for the optimisation is. However, if you think it's worth it, this is a sound function that does essentially what you want. https://go.dev/play/p/IegHOG0qsyX If spread is greater than one, then clamping will be required. This is the basis curve, jitter uses co-proportional scaling to keep it sensible. Spread is the jitter spread, n is the number of iterations to reach max and i is the iter we're on. The rest should be self-explanatory. |
|
@efd6, So just for clarity the objective function is for the wait time to increase more steadily with the number of attempts rather than hitting the cap (wait max) after like 1-2 retry attempts that's happening right now. |
|
Yeah, got that. I'm just wondering why. I'm happy to have nice maths here, but I don't think the machines care. |
Yea just a personal preference here, the current behaviour was just rubbing me the wrong way. |
|
That's what I thought. I'm fine with that, are you going to use the logistic backoff I posted or keep what you have. If you want to keep what you have, I'll need to look at it again tomorrow. |
I need to test out some scenarios with the code you posted and check the growth curve it's producing with some real world values (I like the base curve the you linked), at the same time I wanted to keep the math simple so it is easy to read and decipher. Will make some sort of decision on this soon. There's no rush here, so I'll finish off a couple of other pending tasks and come back to this. |
The basis for the code is well known (two features: logistic growth and that x(1-x) is under x and (1-x) for the domain). The |
|
Yea comments would be great. |
|
|
@efd6, I've updated the backoff logic with your suggestions |
|
@efd6, updated the spread to 1.0 and this seems good. Thanks for helping out on this, was very nice to get a deeper mathematical perspective. |
|
/test |
Type of change
Proposed commit message
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Existing Backoff Curve:
New Backoff Curve:
Logs