NixOS · Toolchain · Why does nixos-tools use twice the memory of comparable tools?

7
NIr/nixos-tools·posted by tang_hao·2 hours agoJobs

Why does nixos-tools use twice the memory of comparable tools?

Short version: nixos-tools needs almost no tuning at small and medium scale — the point where it starts to hurt is much further out than most people assume. Full measurements below.

Worth noting: the official docs do cover this, just in a very inconspicuous spot. I only found it reading the source comments, where the author explains the reasoning — roughly "so that it degrades into predictable behaviour in extreme cases".

Image placeholder · object storage in production
POST /api/uploads → CDN origin pull
4 comments

4 comments

M
Rrase·12 minutes ago

Worth learning from this debugging approach. We went straight at the logs and took a much longer route.

501
Kkernel_panic·28 minutes ago

There is actually a simpler fix that needs no architecture change: move this check up to the gateway and the problem disappears. The cost is one extra lookup at the gateway.

164
Oops_wang·1 hour agoedited

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

332
Wwinter·28 minutes ago

Saved. I am reworking this area this week — this saves a lot of wrong turns.

40

This is the post detail page /en/c/nixos-tools/post/p7. Posts and comments are generated deterministically from a seeded PRNG, so the same post always renders the same content and the link can be shared, reloaded and indexed. In production this page reads MySQL for the post, Redis for hot-post caching, and fetches the whole comment tree in a single query on the path column.

See the database schema →