# Cutting cloud spend by ~15%

Building IoT platform (Primustech), 2026. Case study by Li ZhenXi. Page: https://portfolio-emsghin2iq-as.a.run.app/work/reaper

> Measured first, then cut monitoring, database and compute, with every trade-off written down.

- **~15%**: cloud spend cut, with no alert dropped
- **914**: orphaned Kafka topics reaped, 86% of all topics
- **10,386 → 2,891**: samples per scrape from the Kafka exporter

## The problem

Nobody had measured where the money went. Managed Prometheus alone was about US$106 a month, the third-largest line item, and climbing with no matching growth in traffic.

## What I did

1. Traced the metric bill to 914 orphaned Kafka topics, 86% of all topics, and shipped a scheduled reaper. Samples per scrape from Kafka fell from 10,386 to 2,891.
2. Dropped three metric packages that no alert or dashboard used, a 40% cut in samples per scrape, and kept cAdvisor because three memory alerts depend on it.
3. Right-sized Cloud SQL from 4 vCPU/16 GiB to 2 vCPU/12 GiB and moved it from regional HA to zonal, with the recovery trade-off documented.
4. Cut Core API pod requests from 1 CPU/4 GiB to 0.5 CPU/3 GiB so pods pack onto fewer nodes, and retired a replaced ingestion lane end to end.

## Result

Cut cloud spend by about 15%, without dropping a single alert.

Tools: Managed Prometheus, Kafka, Kubernetes CronJob, Cloud SQL, GKE autoscaling, Terraform.

## Go further

- [The full cost review, one move at a time](https://portfolio-emsghin2iq-as.a.run.app/iot#platform-cost)
- [The write-up: finding a metrics bill in 914 orphaned Kafka topics](https://portfolio-emsghin2iq-as.a.run.app/writing/metrics-bill-kafka-topics)
