Emre Şahin

Архитектонски студии на случај

FaultMesh

Платформа за инженеринг на хаос и отпорност. Платформа со затворена јамка што внесува дефекти, открива аномалии, автоматски ги отстранува и секој експеримент го претвора во оценка за отпорност поврзана со SLO и буџети за грешки.

Улога
Основач · Архитект · Инженер
Период
2026
Технологии
.NET 10, RabbitMQ, PostgreSQL, Kubernetes, Chaos Mesh, AWS FIS, OpenTelemetry, ML.NET

Overview & business problem

Chaos engineering tools are good at breaking things on purpose. Most of them stop there. They inject a fault, wait for the duration, clean up, and leave the important questions to people: did we notice, how fast, did anything recover, and are we getting better?

FaultMesh is my answer to that gap. It is a personal product I design and build end to end, for teams that want resilience to be measured rather than anecdotal. Every experiment runs through a closed loop of injection, observation, remediation and scoring, and produces time to detect (MTTD) and time to recover (MTTR) as first-class data.

My role & requirements

I am the only engineer, so every decision and every mistake is mine. The requirements I set:

  • The loop must be explicit: every experiment has a single, inspectable state and timeline.
  • Each stage must be replaceable or switchable. A team that does not want automated remediation still gets detection and scoring.
  • Safety comes before features. A tool that breaks things on purpose has to be unusually careful about breaking the wrong things.
  • Tenants must be isolated by default, not by discipline.
  • It has to fit into the places teams already work: CI pipelines, infrastructure as code and AI assistants.

Architecture & design decisions

The diagram on this page is simplified.

FaultMesh is a modular monolith with five planes behind one YARP gateway: Platform (tenants, auth, licensing), Control (experiments), Observation (detection and root cause), Remediation and Scoring. Each plane is a bounded context with the same layering: domain, infrastructure, an API built with Carter, MediatR and FluentValidation, and a worker for background processing. Planes talk only through integration events over RabbitMQ via MassTransit, never through each other's tables.

The loop as a chain of events. Experiment started, fault injected, anomaly detected, remediation completed, score calculated, experiment completed. A saga state machine owns each experiment's state and timestamps, so MTTD and MTTR are fields, not queries.

A router in front of fault providers. Injection goes through a router that picks a provider by target platform and fault type: Chaos Mesh for Kubernetes, AWS Fault Injection Service for cloud workloads, and a lightweight host agent for VMs and bare metal.

An ensemble of simple detectors. Observation runs six detectors (Z-score, CUSUM, Holt-Winters, STL residuals, Isolation Forest and Granger causality). At least two must agree, and confidence is the share that agreed. A root-cause step ranks services by causality weighted by downstream fan-out.

Scoring as SLOs. Service-level indicators, burn rates, a resilience score and a maturity level.

Reliable messaging. A transactional outbox ties state change and publish together, and exhausted retries land in replayable error queues. Here, a lost message can mean a fault nobody knows is running.

Trade-offs

Modular monolith before microservices. Event-only communication gives me the seams to split later, for example the CPU-heavy observation plane, without paying for five pipelines and distributed debugging before there is a reason to.

Simple detectors over one clever model. An ensemble has independent failure modes, testable members and output that names which detectors fired. Operators trust what they can reason about. The cost is more tuning surface.

Schema per tenant over a shared schema. Isolation becomes the default, and per-tenant backup, restore and deletion are straightforward. The price is migration complexity across many schemas, which I accept for a product aimed at security-conscious teams.

Abstractions from a second real consumer. When cloud support arrived, I added only the seams I could verify, and refused to write the deep refactor until the second provider existed.

Security & scalability

Safety controls sit in front of and inside the loop:

  • Blast radius as both a percentage and an absolute cap. If the target count cannot be determined, the experiment does not start.
  • Kill switch at global, tenant and experiment level, checked before start and during execution.
  • Approval and auto-abort. Experiments can require approval, and a safety monitor aborts and cleans up when service-level indicators breach their envelope.
  • Policy gates in front of remediation, with dry-run, dependency-aware sequencing and an append-only audit trail.
  • Host agent that connects outbound only, uses revocable per-agent credentials, and aborts faults on its own if it loses contact with the server.

Tenant data is isolated with schema per tenant on PostgreSQL with Citus, plus query-level tenant filters as a second layer. Every integration event carries a required tenant id, so tenant context cannot silently disappear as a message crosses planes.

For teams that cannot use a hosted service, FaultMesh ships as a Helm chart with a Kubernetes operator, and integrates through a Terraform provider written in Go, a CI resilience gate and an MCP server.

Results & lessons learned

FaultMesh is a personal product under active development, not a commercial service with customers, so I do not publish production metrics. The closed loop, the Kubernetes path through Chaos Mesh, the detector ensemble, scoring, the core safety guardrails and the host agent are built, and the Kubernetes path is covered by integration tests against a real cluster. The AWS provider is built and unit-tested offline but not yet verified against a live account.

What I'd do differently today

  • Design the target abstraction before the first provider. My provider interface looked platform-neutral, but its contract was Kubernetes-shaped: namespaces, pod counts, label selectors. Adding AWS was not "write another provider"; it required making the target model neutral first. A leaky abstraction is cheap to write and expensive to discover.
  • Build guardrails before features. I built the loop, detection and scoring before auto-abort, absolute caps and approval were complete. A closed loop with incomplete guardrails is a faster way to cause an incident.
  • Make every silent failure loud from day one. Early cleanup paths swallowed exceptions. In a chaos tool, a cleanup failure nobody sees is the worst kind of bug. Logging, retries and alerts on cleanup belong in the first commit.