Content Deep Dive
Reclaiming CPU for free with Go's Profile Guided Optimization
Blog post from Cloudflare
Post Details
Company
Date Published
Author
Colin Douch
Word Count
1,278
Language
English
Hacker News Points
-
Summary
Golang 1.20 introduced Profile Guided Optimization (PGO), which allows guiding the compiler to introduce optimizations based on real-world behavior of a system. PGO can lead to CPU usage reductions, freeing up resources for better customer service. The process involves compiling a non-PGO binary and deploying it to production, collecting CPU profiles from the binary in production, and then compiling a second binary using that CPU profile. An example is provided where PGO was used on Cloudflare's "wshim" system, leading to significant CPU usage reductions. Future work includes automating profile collection, refining deployment processes, and implementing further improvements with other optimization techniques.