Fortran · Resources · I upgraded our production fortran-resources and hit these 11 landmines

1.7K
FOr/fortran-resources·posted by huang_ke·1 hour agoTooling

I upgraded our production fortran-resources and hit these 11 landmines

It took me two weeks of on-and-off digging and plenty of wrong turns. Writing the process down as it happened so the next person spends less time.

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
272 comments

272 comments

· first 120 loaded
M
Wwinter·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.

520
Nnikic·2 days ago

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

1
Kkite·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.

7
Wwinter·2 days ago

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

479
Sslow_query·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.

463
Wwinter·12 minutes ago

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

457
Llinlin·just now

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

261
Mmike_xu·3 minutes ago

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

295
NnikicMod·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.

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

171
Nnikic·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.

414
Rran_bo·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.

368
Rran_bo·2 days ago

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

192
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.

84
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.

12
Oops_wang·2 days ago

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

115
Bbob_chen·yesterday

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

56
Ttang_hao·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.

83
Llinlin·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.

405
Kkite·just now

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.

404
Llinlin·3 minutes ago

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

337
Wwinter·2 days agoedited

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

168
Llinlin·2 days ago

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

189
Mmike_xu·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.

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

317
Bbob_chen·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.

304
Sswoole_lee·5 hours ago

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

267
Ddev_zhou·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.

261
Cchen_dev·just now

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.

143
Bbob_chen·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.

433
Ddev_zhou·28 minutes ago

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

1
Nnikic·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.

12
Lli_ming·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.

3
Rrase·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.

259
WwinterOPMod·2 days ago

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

197
Mmike_xu·2 days ago

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

255
Llinlin·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.

228
Kkernel_panic·just now

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

1
Cchen_devOP·12 minutes ago

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

152
Bbob_chen·2 days ago

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

207
Wwinter·2 days ago

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

51
Aalice_dev·2 days ago

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

202
Oops_wang·2 hours 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.

242
Sslow_query·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.

189
Kkite·28 minutes ago

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

155
Sswoole_lee·2 days ago

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

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

294
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.

19
Llinlin·2 hours ago

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

5
Sswoole_lee·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.

150
Ttang_hao·5 hours ago

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

66
Aalice_dev·2 days agoedited

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

142
Cchen_dev·yesterday

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.

125
Kkernel_panicOP·2 days ago

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

260
Cchen_devOP·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.

431
Kkite·2 days ago

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

516
Hhuang_ke·2 days agoedited

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

307
Mmike_xuOP·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.

54
Ddev_zhouMod·just nowedited

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

152
Kkernel_panic·5 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.

14
Nnikic·28 minutes ago

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

81
Lli_ming·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.

435
Sswoole_lee·3 minutes agoedited

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

427
Kkite·2 days agoLevel 6

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.

126
Ttang_haoOP·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.

4
Rrase·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.

11
Ttang_hao·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
Rrase·2 days agoLevel 6

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

1
Rrase·2 days agoLevel 6

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

1
Sswoole_lee·5 hours 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.

38
Nnikic·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.

115
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.

35
Wwinter·2 days agoLevel 6

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

6
Zzhu_zong·1 hour 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.

4
Sswoole_leeMod·2 hours 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.

81
Lli_ming·2 days agoLevel 6

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

1
RraseMod·5 hours 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.

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

25
Zzhu_zongMod·1 hour 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.

74
Zzhou_yi·1 hour ago

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

327
Hhuang_keMod·2 days ago

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

225
Sswoole_leeMod·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
Mmike_xu·12 minutes ago

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

51
LlinlinOP·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.

24
Oops_wang·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.

17
Zzhu_zong·2 days agoedited

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

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

19
Kkernel_panic·28 minutes ago

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

88
Cchen_devOP·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.

4
Rran_bo·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.

53
WwinterOPMod·2 days ago

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

229
Ddev_zhouMod·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.

42
Ddev_zhou·1 hour 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.

31
Cchen_dev·2 days ago

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

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

257
Ttang_hao·yesterday

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

164
Hhuang_ke·2 days ago

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

39
Hhuang_ke·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.

25
Rran_bo·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.

15
Mmike_xu·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.

21
Ddev_zhou·2 days ago

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

17
Kkite·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.

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

15
Hhuang_ke·yesterday

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.

9
Mmike_xu·2 days ago

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

8
Cchen_dev·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.

7
Nnikic·2 days ago

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

5
Hhuang_ke·3 minutes ago

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

2
Ttang_hao·12 minutes ago

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

77
Llinlin·2 days ago

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

110
Lli_mingOP·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.

21
Rrase·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.

211
Oops_wang·2 days ago

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

21
Kkite·2 days ago

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

73
Kkernel_panic·2 days ago

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

271
Aalice_dev·2 days ago

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

2
Lli_ming·1 hour 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.

1
Nnikic·5 hours 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
Rrase·2 days ago

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

1
Cchen_dev·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.

1

This is the post detail page /en/c/fortran-resources/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 →