01
Discord EngineeringUNREAD
How Discord Resizes 150 Million Images Every Day with Go and C++
Discord replaced a Python image-resizing proxy with a Go service after the original showed uneven workload distribution and high latency variance. Because no Go resizing package could beat pillow-simd, they built Lilliput, a Go package wrapping OpenCV and C image libraries via Cgo—accepting forked dependencies, manual memory management, and hard-to-debug leaks and race conditions. The rewrite cut server instances by 60% and reduced latency variance, but required extensive profiling, fuzzing, and custom GIF and video handling.