Cloud infrastructure

A smaller cloud bill and one place to trace a slow request

Cloud spend kept rising without traffic growth, so we right-sized capacity, cut log waste and put distributed tracing in one view.

The situation

The monthly cloud bill went up even when traffic did not. Servers sized for the worst-case peak ran around the clock at low use. Database queries without indexes used up CPU, and log storage grew every month.

When something broke, finding the cause took hours. Engineers moved between several dashboards to follow one request through the services.

Cutting cost could not mean seeing less when something went wrong.

What we did

  1. 01

    Audited what was running and why

    We matched the bill to actual use on AWS and GCP, and listed servers running far below capacity and queries that wasted CPU.

  2. 02

    Moved capacity to spot autoscaling

    We used Karpenter to provision spot capacity that matches what containers actually request, instead of fixed worst-case sizes.

  3. 03

    Added query caching

    Caching tiers and index fixes took repeated work off the database.

  4. 04

    Put OpenTelemetry tracing across the services

    Distributed tracing followed requests across services. Sampling kept the traces that matter, such as errors, and cut the volume of logs ingested.

  5. 05

    Brought it into one view

    Traces and metrics landed in a single Grafana view, so a latency spike could be found in one place.

What changed

  • The cloud bill came down without cutting traffic or features.
  • Capacity now follows demand instead of the worst-case peak.
  • Log and trace volume fell because sampling kept the useful data.
  • Finding a slow request takes one dashboard instead of several.

Stack

  • AWS
  • GCP
  • Karpenter
  • Spot instances
  • OpenTelemetry
  • Grafana