TLDR Web Dev · ARTICLES & TUTORIALS

HOW DISCORD REDUCED WEBSOCKET TRAFFIC BY 40%

discord.com17 min read

Summary from the TLDR Web Dev newsletter

Discord reduced its websocket traffic by 40% through two key optimizations. Firstly, it replaced its existing compression algorithm, zlib, with zstandard, achieving higher compression ratios and shorter compression times. It further improved performance by implementing streaming compression for zstandard, allowing it to utilize historical data for better compression of small payloads. Secondly, it introduced Passive Sessions v2, which only sends updates about changes in server information instead of sending complete snapshots.