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

[Feature]: Improve timeout mechanism in Curp #162

Closed
1 task done
markcty opened this issue Jan 31, 2023 · 0 comments
Closed
1 task done

[Feature]: Improve timeout mechanism in Curp #162

markcty opened this issue Jan 31, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@markcty
Copy link
Contributor

markcty commented Jan 31, 2023

Description about the issue

Currently, our code uses a real system time timeout mechanism, which is straight forward and easy to understand. However, obtaining system time is not efficient. We need to update last_rpc_time every time we receive a new append_entries, which could lead to performance issue when the server is busy.

Etcd offers a more clever timeout detection mechanism based on tick. A task is spawned to periodically perform tick operation. Every tick is 1 heartbeat interval. A tick will increase election_timeout and heartbeat_timeout by 1. A broadcast of heartbeats(for leader) or a new round of election(for follower) will be performed when timeout.

I believe adopting this method will improve curp’s performance as well as readability(since all periodically executed operations will be in one place).

Approach

  • Remove last_rpc_time. Add heartbeat_timeout and election_timeout tick count.
  • Merge timeout logic inside bg_election and bg_heartbeat.
  • Add tick logic and relevant tests.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@markcty markcty added the enhancement New feature or request label Jan 31, 2023
@markcty markcty self-assigned this Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant