Hacker News·4 min read·hard

A 40ms Go garbage collector pause caused by swap

S
shellpipe
A 40ms Go garbage collector pause caused by swap
✦AI Summary

A software engineer discovered that running a Go application with swap memory enabled can lead to significant performance degradation. The garbage collector's stop-the-world pauses were extended to 40ms due to page faults occurring when the system accessed swapped-out metadata.

Why it matters

This highlights a critical performance pitfall for developers managing memory-intensive Go applications in production environments where swap is enabled.

✦Dive DeeperCreate a free account to unlock

I'm writing this so you don't slap your forehead like I almost did when I decided to run swap in production to absorb memory spikes.

I had a cgroup with two processes: one is a Go process that calls io.ReadAll and then proto.Unmarshal , creating a blob and then a graph struct (which is marked as scan by Go's allocator). The other process is an HTTP server that mostly stays quiet.

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technologyscience
✦

Get smarter about the news

Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.

Create free account

Already have an account? Sign in