Need help?
<- Back

Comments (93)

  • nasretdinov
    Unfortunately that's somewhat expected - regardless of implementation, the sole fact that the GC needs to somehow walk the entire tree to trace still referenced sections makes swap highly impractical -- even if you had not had 40ms stop-the-world pauses the LRU cache used by swap would get thrown away at every GC.I believe that's actually the same reason why Apple stopped using GC in their frameworks in favour of automatic reference counting.
  • jacobgold
    "It hurts when I do this""Stop doing that"If you care about latency, disable swap. System wide or for the specific the cgroup.
  • xavdid
    Discord learned this back in 2020 and published a great blog post on it: https://discord.com/blog/why-discord-is-switching-from-go-to...
  • pizlonator
    Is there a reason why Go isn’t using on the fly GC, where there’s no STW at all?
  • soltanov
    A GC latency SLO should include operating-system memory pressure. Otherwise, a page-fault problem will look like a collector problem and lead to the wrong fix.
  • Gabrys1
    I started wondering if there could be swap-aware GC, like first make the required page swapped in (not that there's any obvious API for that...) and only then pause the world?
  • imclaren
    This. Memory bloat bugs are relatively easy to fix in Go, but sometimes it’s an adventure to remove swap bloat. And I think it’s worth removing all swap bloat!
  • faangguyindia
    I use Go where i'd use Node, Ruby or Python.I use Rust where i need low latency.
  • ahmedmostafa16
    The nasty bit is that swap doesn't just make the allocation slower; if GC metadata gets paged out, you have turned memory pressure into a stop-the-world latency spike.
  • charcircuit
    If memory is paged out we could defer cleaning out garbage from it.
  • raverbashing
    I don't get why people do not prefer reference counting, it has more predictable runtime performance(though of course a swap is a swap - but you can "trigger" it depending on your memory or file access pattern)
  • amelius
    When my system starts using swap space, I've already given up all hopes of a decently running system, so IMHO this particular "bug" doesn't matter much.I'm being downvoted, but honestly, is anyone always testing their software while swap is active?
  • loeg
    So, uh, mlock those pages?
  • octoberfranklin
    Yet another reason why "no runtime" is such a huge advantage.
  • lin7c
    [flagged]
  • palaceme
    [flagged]
  • truth_seeker
    What is stopping the author to use latest version of Go and Linux Kernel ?