Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Wise Engineering 9 min read Case study mediumAdept

Grafana Mimir Compaction: From Bottleneck to Savings

After migrating from Thanos to Grafana Mimir at about 6 million samples per second, Wise found its compactor quietly falling behind on its largest tenant. The result was a two-month backlog of roughly 250k uncompacted blocks, with block metadata sync taking around 9 hours, and it showed up as higher query errors and latency, bloated S3 storage and extra cross-AZ traffic. Giving the compactor more CPU and memory and tuning its config parameters in staging cleared the backlog. That cut S3 usage by 70%, cross-AZ transfer by 40% and query latency by about 90%. The main lesson is to alert on per-tenant block growth and compaction health, because the default mixin dashboards and alerts did not flag the problem.

Assumes: Prometheus metrics storageobject storage basicsTSDB blocks and compaction

Related posts

  • Husky: Efficient compaction at Datadog scale

    Datadog Engineering hardMaster

    Husky, Datadog's observability event store layered over object storage, keeps query cost low by controlling fragment count and layout through streaming compaction. Writers flush small sorted fragments into time-bucketed tables. Compactors lazily run size-tiered k-way merges, waiting until a few dozen fragments are available, which cuts CPU and object-store API costs by an order of magnitude. Metadata is swapped atomically in FoundationDB. A custom columnar format with per-column headers and fixed-size row groups lets each compaction use one GET per input, saturate the CPU and run in bounded memory, and sort schemas let queries skip fragments using only their metadata.

  • Observability At Scale — Every Byte Counts

    Wise Engineering mediumAdept

    Five observability changes at Wise cut monthly spend by 40%. Switching Loki chunk compression from Snappy to lz4 cut S3 storage and cross-AZ traffic by roughly 50% with negligible CPU impact. Moving the OpenTelemetry Collector to Tempo path from gzip to zstd reduced Tempo ingest by about 40%, and upgrading Prometheus to Remote Write v2 dropped daily traffic to Mimir from ~16TB to ~5.5TB. Aligning Loki's split_queries_by_interval with the ~1-hour p90 chunk span eliminated redundant chunk reads, and an AI-assisted investigation tracked down a Fluent Bit connection limit, with the overall lesson being to challenge defaults on high-volume data paths and validate against measured cost.

  • Xet is on the Hub

    Hugging Face mediumAdept

    Hugging Face migrated its first model and dataset repositories from Git LFS to Xet storage, which uses content-defined chunking (~64 KB chunks aggregated into ~64 MB blocks) so that only changed bytes are uploaded. The migration moved 4.5 TB and ~6% of Hub download traffic in one day and exposed two production issues. First, unaligned range requests from hf_transfer forced CAS to stream whole blocks, a 4:1 read amplification. Adding chunk-length metadata to the block format fixed this and cut GET latency ~35%. Second, unflushed page cache during uploads caused disk throttling and pod load imbalance, which was mitigated with per-pod concurrent upload limits. The core lesson is that incremental migrations of real traffic surface problems test environments can't.

  • How SolarWinds uses ClickHouse BYOC for real-time observability at scale

    ClickHouse mediumAdept

    SolarWinds ingests about 3 million telemetry messages per second, roughly 550 MB/s with 1 GB bursts, into ClickHouse ReplacingMergeTree tables. Its hottest data, the most recent 60 minutes, suffered when merges lagged behind ingestion. Reducing index granularity, verified by A/B testing a mirrored table through an internal query router, cut five-minute-window query latency from 76 ms to 28 ms. The tradeoffs were primary-key index memory growing from 10 GB to as much as 320 GB and merge times rising nearly 50%. Switching file reads from pread_threadpool to pread on fast SSDs added further gains, and the team moved to ClickHouse BYOC on AWS for S3-backed storage, compute-compute separation and lower operational overhead.

  • Making multiplayer more reliable

    Figma mediumAdept

    Figma added a write-ahead journal to its in-memory multiplayer service, which previously persisted files only via full checkpoints to S3 every 30–60 seconds. Incremental changes are now batched and written to DynamoDB with sequence-number ranges. File ownership is enforced with a lock table and conditional writes to prevent split-brain corruption. Cross-region durability comes from guaranteeing a checkpoint within 30 minutes, since DynamoDB global tables would have cost about 6x more. After ~400K byte-identical replay validations during a dark launch, the journal handles over 2.2B changes per day, persists 95% within ~600ms, and removes checkpoint write spikes during deploys.

The quest for software engineering knowledge.

Look:
Layout: