Hystrimp is a Go implementation of Hystrix, an innovative project from Netflix.
Hystrimp/Hystrix provide robustness and resilience in systems with external dependencies, particularly distributed systems (see this excellent introduction). Because the reality of distributed systems is complex, one should never interact with a remote API as if it were composed of local functions. Instead, one should consider important questions such as:
- How long am I willing to wait for the remote system's response?
- What should I do if I time out before receiving a response?
- What do I do if the remote system responds with an error?
- If a request times out or returns with an error, should I retry it?
- How many times should I retry the request?
- How long should I wait before retrying?
- Should I bound the number of parallel requests I make?
- If the remote system is overloaded with requests, is my system part of the problem?
- How long should my system back off to allow the dependency to recover?
Hystrimp provides a Go implementation of these ideas:
It improves upon hystrix-go (similar project) in the following ways:
- Support for automatic retry of command with backoff upon remote errors or timeouts.
- Remote commands are grouped into logical services
- Support for concurrency limits on the service as a whole
- Support for circuit breakers on a service as a whole
- Better ergonomics/interface
- Simpler implementation
- Install Go
- Install Godep (
go get github.com/tools/godep
) - Run
godep get github.com/Workiva/go-hystrimp/...
When new code is available on master, you can update with go get -u github.com/Workiva/go-hystrimp/...
To run unit tests, do
cd $GOPATH/src/github.com/Workiva/go-hystrimp
godep go test ./...
godep go build -o hystrimp-example -tags example ./example/main
./hystrimp-example
To contribute, do the following:
- Create a feature branch from master
- Implement your contributions
- Ensure unit test coverage
- Ensure that you've complied with these guidelines
- gofmt your code
- Commit with good commit messages
- Create PR back to master
Bug reports and ideas for improvement are welcome! Please use GitHub's issue tracker.
Tom Deering <tom.deering@workiva.com>