NixOS · Toolchain · Choosing nixos-tools: I turned 5 options into a side-by-side comparison

34
NIr/nixos-tools·posted by kite·3 days agoInternals

Choosing nixos-tools: I turned 5 options into a side-by-side comparison

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.

One last trap: in container environments remember to adjust the memory-related parameters in step. Otherwise the host limit and the process expectation disagree, and the symptom is intermittent, unreproducible failure.

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

11 comments

M
Lli_ming·2 hours ago

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

434
Ddev_zhou·12 minutes ago

I just read the nixos-tools source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

314
Lli_mingMod·just now

One counter-example: below nixos-tools 7.4 the semantics of that code are different, so do not copy it verbatim. We got burned in staging and rolled back once.

192
Rran_bo·1 hour agoedited

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

427
Ddev_zhou·5 hours ago

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

459
Rrase·1 hour ago

Thanks for sharing real numbers — far more useful than the articles that only cover concepts.

54
Nnikic·3 minutes ago

Sharing our numbers, 8 cores 16GB, same scenario:

| Concurrency | P50 | P99 |
|---|---|---|
| 200 | 12ms | 88ms |
| 500 | 31ms | 340ms |

P99 clearly collapses at 500 concurrency, which lines up with your knee point.

49
Ddev_zhouOP·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.

9
Aalice_dev·28 minutes ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

25
Nnikic·12 minutes ago

This is not a nixos-tools problem, it is a usage problem. The docs say this API is not thread-safe and you must lock around it yourself.

421
Zzhu_zongOP·5 hours ago

Can you give a minimal reproduction? I ran it locally for ten minutes and could not reproduce on macOS with the latest version.

168

This is the post detail page /en/c/nixos-tools/post/p4. 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 →