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

Will using aync/atomic for incrementing and loading/storing the counts improve performance? #62

Open
HarshKumar17 opened this issue May 6, 2024 · 1 comment

Comments

@HarshKumar17
Copy link

HarshKumar17 commented May 6, 2024

Is any benchmarking available for this circuit breaker? Will it help to use sync/atomic to keep the counts instead of using mutex for locking?
Or are there some race conditions not satisfied by sync/atomic that I am overlooking.

@HarshKumar17 HarshKumar17 changed the title Why not use aync/atomic for incrementing and loading/storing the counts? Will using aync/atomic for incrementing and loading/storing the counts improve performance? May 6, 2024
@YoshiyukiMineo
Copy link
Member

YoshiyukiMineo commented Oct 13, 2024

The circuit breaker uses mutex to maintain consistency among those related data:
https://github.com/sony/gobreaker/blob/v2.0.0/v2/gobreaker.go#L127-L130

sync/atomic cannot maintain consistency among multiple data.

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

No branches or pull requests

2 participants