Cloud Native 9 min read

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.

Cloud Native Technology Community
Cloud Native Technology Community
Cloud Native Technology Community
How to Implement Circuit Breaking for Thrift Services with Aeraki Mesh and Istio

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   16m

Simulating 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: 9090

The 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: 5m

Once 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: 1

How 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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

KubernetesIstioService MeshAerakiCircuit BreakingThrift
Cloud Native Technology Community
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.