Modding · Reading list · Two weeks with modding-books: what feels right and what drives me up the wall

2.1K
MOr/modding-books·posted by li_ming·6 hours agoReview

Two weeks with modding-books: what feels right and what drives me up the wall

Short version: modding-books 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.

The first thing was to collapse the variables. We were changing config and upgrading the version at the same time, and afterwards nobody could say which change caused what. We rolled back to moving one variable at a time, re-ran three times, and only then did the curve settle. Tedious, but not skippable.

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

950 comments

· first 120 loaded
M
Mmike_xuOP·2 hours ago

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

488
Zzhou_yiOP·2 days ago

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

439
Zzhu_zong·2 days ago

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

479
Zzhu_zong·28 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.

442
Lli_ming·1 hour ago

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

428
Kkernel_panic·2 days ago

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

228
Ddev_zhou·2 days 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.

52
Aalice_dev·2 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.

239
Sswoole_lee·2 days agoedited

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.

379
Lli_mingMod·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

369
Llinlin·2 days ago

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

334
Nnikic·2 days ago

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

423
Rrase·2 days ago

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

326
Kkite·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

311
Aalice_dev·2 days ago

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

48
Kkite·2 days 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.

308
Oops_wang·2 days 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.

348
Wwinter·2 days ago

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

58
Ttang_hao·12 minutes ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

299
Rran_bo·2 days ago

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

297
Nnikic·2 days ago

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

246
Mmike_xu·2 days 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.

211
Kkernel_panic·1 hour agoedited

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

192
Sswoole_lee·2 days ago

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

411
Ddev_zhou·2 days 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.

302
Kkernel_panic·2 days ago

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

21
Ttang_hao·2 hours ago

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

186
Bbob_chen·2 days ago

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

163
Hhuang_ke·2 days agoedited

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.

159
Sswoole_leeOP·5 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.

94
Sswoole_lee·2 days 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.

241
Kkite·12 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.

1
Cchen_dev·12 minutes ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

124
Nnikic·2 days ago

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

431
Kkite·2 days ago

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

424
Sslow_query·2 days agoedited

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

105
Ttang_haoOP·just now

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

2
Wwinter·2 days ago

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

344
Zzhou_yi·3 minutes ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

191
Sswoole_lee·12 minutes agoedited

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.

460
Ddev_zhou·just now

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

335
Mmike_xu·1 hour ago

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

229
Lli_ming·5 hours ago

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

337
Bbob_chen·2 days agoLevel 6

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

2
Nnikic·2 days ago

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

323
Rran_bo·2 days ago

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

17
Ttang_hao·12 minutes agoLevel 6

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

14
Nnikic·2 days ago

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

31
Oops_wang·1 hour ago

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

355
Nnikic·2 days agoLevel 6

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

394
Mmike_xu·2 days agoLevel 6

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.

259
Zzhou_yi·1 hour agoedited

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

194
Lli_ming·2 days agoeditedLevel 6

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.

58
Sslow_query·2 days ago

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

35
Ttang_hao·2 days agoLevel 6

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

438
Aalice_devOP·2 days agoLevel 6

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

295
Ddev_zhou·2 days agoLevel 6

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.

140
Ttang_hao·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

11
Ddev_zhou·2 days agoLevel 6

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

90
Sswoole_lee·28 minutes ago

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

3
Mmike_xu·2 days agoLevel 6

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

83
Cchen_dev·3 minutes ago

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

14
Oops_wang·3 minutes ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

41
Kkernel_panic·2 days agoLevel 6

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.

492
Sswoole_lee·12 minutes 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.

31
Ddev_zhou·2 days agoLevel 6

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.

388
Rrase·28 minutes ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

112
Cchen_dev·2 days ago

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

99
Cchen_dev·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

425
Sslow_query·1 hour ago

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

90
Ttang_hao·5 hours ago

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

387
KkiteOP·2 days ago

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

459
Sswoole_lee·2 days ago

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

184
Nnikic·2 days ago

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

52
Lli_ming·2 days ago

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

2
Rran_bo·2 days ago

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

26
Rrase·2 days ago

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

66
Sslow_query·2 days agoedited

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

3
Sslow_query·2 days 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.

64
Nnikic·2 days agoedited

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

57
Cchen_dev·28 minutes ago

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

50
Cchen_dev·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

308
Zzhou_yi·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.

226
Rrase·2 days 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.

40
Ttang_haoOP·2 days 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.

76
Kkernel_panic·2 days ago

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

39
Mmike_xu·5 hours ago

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

30
Sswoole_lee·2 days ago

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

29
Wwinter·2 days 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.

71
Ddev_zhou·2 days agoedited

I see point 3 differently. The trade-off depends on your read/write ratio: read-heavy with little writing means caching actually widens the inconsistency window.

172
Zzhou_yi·2 hours 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.

24
Aalice_dev·2 days ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

22
Nnikic·just now

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

16
Zzhu_zongOPMod·1 hour 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.

155
Oops_wang·2 days ago

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

258
Zzhou_yi·2 days 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.

16
Wwinter·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.

13
Ttang_hao·2 days 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.

95
Hhuang_ke·2 days agoedited

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

7
Mmike_xu·12 minutes ago

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

5
Wwinter·2 days agoedited

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

6
Ttang_hao·2 days ago

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

4
Oops_wang·2 days ago

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

5
Ttang_hao·3 minutes ago

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

404
Zzhou_yi·2 days agoedited

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

294
Ddev_zhou·2 days ago

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

195
Ttang_hao·2 days ago

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

4
Wwinter·2 days 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.

2
Nnikic·2 days 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.

2
Llinlin·2 days 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.

1
Wwinter·2 days ago

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

364
Kkite·2 days agoedited

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

11
Ttang_haoOP·12 minutes agoedited

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

2
Ddev_zhou·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

176
Sslow_query·3 minutes ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

137
Ttang_hao·2 days ago

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

1
Oops_wang·2 days ago

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

46
Nnikic·2 days ago

Has anyone run a controlled experiment? I did, reducing it to a single variable, and the difference was 4% — within noise. So I suspect the main cause is something else.

224
Sswoole_lee·2 days ago

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

59
Cchen_dev·2 days 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.

1

This is the post detail page /en/c/modding-books/post/p6. 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 →