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

sync: use exponential backoff when encountering short-lived loops #517

Closed
wants to merge 1 commit into from

Conversation

xenoscopic
Copy link
Member

@xenoscopic xenoscopic commented Oct 18, 2024

What does this pull request do and why is it needed?

When we encounter system-level errors (such as ENOSPC), our best bet is to keep the run loop alive and continue retrying synchronization. However, if we try too aggressively, then we end up spinning on the CPU. Our best bet is to use an exponential backoff strategy driven by the number of sequential short-lived synchronization loops encountered. This PR implements such a backoff strategy.

Any other notes for the review process?

It's probably(?) not worth porting this to the forwarding controller because the types of system-level errors that would cause forwarding to fail would typically be caught at endpoint connection (e.g. when a listener is established). In that case, we sleep for the auto-reconnect interval, which means we won't spin. This backoff is designed for those persistent system-level errors that allow synchronization endpoints to connect but then immediately fail the synchronization loop.

When we encounter system-level errors (such as ENOSPC), our best bet is
to keep the run loop alive and continue retrying synchronization.
However, if we try too aggressively, then we end up spinning on the CPU.
Our best bet is to use an exponential backoff strategy driven by the
number of sequential short-lived synchronization loops encountered.

Signed-off-by: Jacob Howard <jacob@mutagen.io>
@xenoscopic xenoscopic closed this Oct 18, 2024
@xenoscopic xenoscopic deleted the short-lived-exponential-backoff branch October 18, 2024 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant