In this scenario, you will learn how to use Circuit Breakers within Envoy Proxy to cause applications to fail quick based on certain metrics within the system, such as active HTTP connections.
"Circuit breaking is a critical component of distributed systems. It’s nearly always better to fail quickly and apply back pressure downstream as soon as possible." Envoy Proxy
Handling Failures With Circuit Breakers
Step 1 - Deploy HTTPBin Client
A Circuit Breaker is a design pattern that allows systems to define limits and restrictions that protect them from being overloaded. If errors start to happen or too much load for the system to handle is created, the Circuit Breaker is tripped and requests fail in a known, consistent approach. This allows the calling application to handle the errors gracefully.
Without a Circuit Breaker in place, unknown system errors or inconsistencies may appear causing additional problems and unexpected results.
Within the Istio architecture, Envoy Proxy is used to manage traffic between services. As a result, all the functionality available within Envoy is exposed via Istio, such as Envoy's Circuit Breaker. The types include:
Cluster maximum connections: The maximum number of connections that Envoy will establish to all hosts in an upstream cluster.
Cluster maximum pending requests: The maximum number of requests that will be queued while waiting for a ready connection pool connection.
Cluster maximum requests: The maximum number of requests that can be outstanding to all hosts in a cluster at any given time.
Cluster maximum active retries: The maximum number of retries that can be outstanding to all hosts in a cluster at any given time.
In this example, we'll deploy an HTTPBin service. The service echoes the HTTP request as a response, allowing us to identify responses and errors easily.
Deploy the application with
kubectl apply -f <(istioctl kube-inject -f samples/httpbin/httpbin.yaml)