hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Artifact downloading from Hydra buffers the whole artifact into RAM before sending it

Open delroth opened this issue 1 year ago • 1 comments

https://github.com/NixOS/hydra/blob/c1bd50a80db45930cdfc1975903d1f76cca1053a/src/lib/Hydra/Controller/Build.pm#L239

The way Hydra artifacts downloads works is that it runs "nix store cat", reads the whole contents into RAM, and then sends it as HTTP response. This has multiple issues for larger files (e.g. disk images):

  • Very long time to first byte, which could cause some clients to time out.
  • Very high RAM usage by the Hydra web workers.
  • Significant decrease in throughput, since the transfer time happens ~ 2x.

We noticed it a few weeks ago on #infra:nixos.org but then this got rediscovered again today on #hydra:nixos.org so I thought it might be worth filing a bug to actually track this.

delroth avatar Feb 05 '24 10:02 delroth

This sometimes ends up hogging all workers on h.n.o, causing the website to become unavailable and channel scripts to fail.

delroth avatar Apr 12 '24 21:04 delroth