Cloudflare

Reclaiming CPU for free with Go's Profile Guided Optimization

May 14, 2024Colin Douch
Reclaiming CPU for free with Go's Profile Guided Optimization
SummaryAI, from the source post

This post details the process of applying Profile Guided Optimization (PGO) to a Go-based service (wshim) within Cloudflare's Observability team. It covers collecting representative CPU profiles from production infrastructure using Thanos and pprof, merging these profiles, and recompiling the service with the `-pgo` flag. The results show a ~3.5% reduction in CPU usage, translating to approximately 97 fewer cores, demonstrating the effectiveness of PGO for optimizing existing code without modification.

More from the Observability Platform trail