How to Implement Circuit Breaking for Thrift Services with Aeraki Mesh and Istio
This tutorial walks through installing Aeraki Mesh and Istio on Kubernetes, deploying a fake Thrift service, configuring an Istio DestinationRule for outlier detection, and verifying that failed endpoints are automatically ejected to prevent cascade failures.
Prerequisites and Installation
Install Aeraki Mesh, Istio, and the sample applications in a Kubernetes cluster. After installation, two namespaces meta-dubbo and meta-thrift appear, each containing a sample program that implements the Dubbo or Thrift protocol via Aeraki's MetaProtocol support.
kubectl get ns | grep meta
meta-dubbo Active 16m
meta-thrift Active 16mSimulating a Thrift Service Failure
Create a deployment that runs an nginx container but is registered as a Thrift service endpoint. This deployment, named thrift-sample-server-fake, adds an endpoint that cannot handle Thrift requests.
apiVersion: apps/v1
kind: Deployment
metadata:
name: thrift-sample-server-fake
namespace: meta-thrift
labels:
app: thrift-sample-server
spec:
selector:
matchLabels:
app: thrift-sample-server
replicas: 1
template:
metadata:
annotations:
sidecar.istio.io/bootstrapOverride: aeraki-bootstrap-config
sidecar.istio.io/proxyImage: aeraki/meta-protocol-proxy:1.0.1
sidecar.istio.io/rewriteAppHTTPProbers: "false"
spec:
containers:
- name: thrift-sample-server
image: nginx
ports:
- containerPort: 9090The thrift-sample-server service now has three endpoints, one of which points to the fake deployment (IP 172.19.0.102). Client logs show a Thrift application exception for every third request because the fake endpoint cannot process the request.
org.apache.thrift.TApplicationException: meta protocol upstream request: remote connection failure '172.19.0.102:9090'Creating the Circuit‑Breaking Rule
Apply an Istio DestinationRule that triggers outlier detection: after five consecutive 5xx errors, the offending host is ejected for 15 minutes.
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: thrift-sample-server
namespace: meta-thrift
spec:
host: thrift-sample-server
trafficPolicy:
outlierDetection:
baseEjectionTime: 15m
consecutive5xxErrors: 5
interval: 5mOnce the rule is active, the client stops sending requests to the failing endpoint after the threshold is reached, confirming that the circuit‑breaker works as intended.
Verifying the Ejection
Query Aeraki sidecar statistics to see that the host has been ejected:
aerakictl_sidecar_stats client meta-thrift | grep -i outlier
cluster.outbound|9090|thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_active: 1
cluster.outbound|9090|thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_consecutive_5xx: 1
cluster.outbound|9090|thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_detected_consecutive_5xx: 1
cluster.outbound|9090|thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_enforced_consecutive_5xx: 1
cluster.outbound|9090|thrift-sample-server.meta-thrift.svc.cluster.local.outlier_detection.ejections_total: 1How It Works
Envoy (the data plane used by Istio) monitors request outcomes. When the configured consecutive error threshold is met, the outlier detection module marks the host as unhealthy and removes it from the load‑balancing pool for the duration specified by baseEjectionTime. This prevents a single faulty service from causing a cascade failure across the mesh.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Cloud Native Technology Community
The Cloud Native Technology Community, part of the CNBPA Cloud Native Technology Practice Alliance, focuses on evangelizing cutting‑edge cloud‑native technologies and practical implementations. It shares in‑depth content, case studies, and event/meetup information on containers, Kubernetes, DevOps, Service Mesh, and other cloud‑native tech, along with updates from the CNBPA alliance.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
