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

breaker for host+service #19

Closed
vtolstov opened this issue Feb 18, 2019 · 6 comments
Closed

breaker for host+service #19

vtolstov opened this issue Feb 18, 2019 · 6 comments

Comments

@vtolstov
Copy link

i want to use gobreaker in my project, i have chained api that looks like this:
request -> api gw -> oauth -> svc1 -> svc2 -> response

oauth, svc1 can work on multiple hosts and if one fails another can work.
doe i need to create different instances of breaker for such thing? or how to deal with such cases?

@YoshiyukiMineo
Copy link
Member

Basically you should create a circuit breaker instance not for each host but for each service. If some part of hosts cannot work due to system failure, you should reduce the load of the remaining hosts.

@vtolstov
Copy link
Author

In case of memory and cpu utilization does this is cheap?

@YoshiyukiMineo
Copy link
Member

By gobreaker, you can suppress requests that are likely to fail and avoid the waste of CPU and memory resources.

@vtolstov
Copy link
Author

vtolstov commented Mar 5, 2019

thanks for help. Last question - how to ignore specific errors for example 404 and 403 error codes does not mean error in service. So i don't want to block it, but may be i want to block only 50x and 408... ?

@YoshiyukiMineo
Copy link
Member

CircuitBreaker can wrap any function to send a request.
https://github.com/sony/gobreaker/blob/master/gobreaker.go#L197

You can ignore specific errors in req func() (interface{}, error).

@vtolstov
Copy link
Author

thanks, I'm use two-step broker variant.

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