‹ BackHN Continuity

Thread

A 40ms Go garbage collector pause caused by swap

92 points · 85 comments · shellpipe

  1. jacobgold · · focus · HN ↗
    "It hurts when I do this"

    "Stop doing that"

    If you care about latency, disable swap. System wide or for the specific the cgroup.

    1. delamon · · focus · HN ↗
      This is not entirely correct. If you care about latency, then it doesn't matter on which major fault your application gets paused. Disabling swap protects you from data pages being evicted, but code pages can still be paged out.

      If you care about latency, mlock() your memory, do not disable swap. Swap is good and gives the kernel an equal opportunity to evict data and code pages.

      1. xxs · · focus · HN ↗
        For GC enabled languages swap is universally bad. Some gc-pauses are indistinguishable from a system crash. It's a side effect on not having tightly specified memory limits.

        I'd rather have applications be oom_killed than having them swap out, the former is rather obvious and demands action.

        1. torginus · · focus · HN ↗
          Please read the article. The issue was caused by swapped out metadata being read in a critical section, not typical heap traversal shenanigans.

          This is not exclusive to GC, any program that reads a rarely accessed piece of memory is vulnerable to this.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.