This repository contains a demo application showcasing the use of the Hystrix circuit breaker pattern in a Go application.
The Hystrix Circuit Breaker Demo project demonstrates how to implement the circuit breaker pattern using Hystrix in a Go application. The circuit breaker pattern is used to prevent cascading failures and to improve the resilience of a system by stopping the flow of requests to a failing service.
To install and run this demo application, follow these steps:
-
Clone the repository:
git clone https://github.com/brilianfird/hystrix-circuit-breaker-demo.git cd hystrix-circuit-breaker-demo -
Install the dependencies:
go mod tidy
To run the demo application, use the following command:
go run .\cmd\server\main.goYou can then access the application at http://localhost:8080. The application provides endpoints to demonstrate the circuit breaker in action.
To visualize the circuit breaker metrics, you can use the Hystrix Dashboard. Follow these steps to set up the dashboard:
-
Run the Hystrix Dashboard using Docker:
docker run --rm -p 7979:7979 --name hystrix-dashboard steeltoeoss/hystrix-dashboard
-
Open your browser and navigate to
http://localhost:7979. -
Point the dashboard to
http://host.docker.internal:8081to monitor the circuit breaker metrics.
The dashboard will display real-time metrics and help you understand the state of the circuit breakers in the application.