Fortran · Resources · Built a visual debugging panel for fortran-resources over the weekend

1.3K
FOr/fortran-resources·posted by alice_dev·6 hours agoTranslation

Built a visual debugging panel for fortran-resources over the weekend

Short version: fortran-resources 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.

Order of investigation, by return on effort: 1. Check downstream latency first — usually it is not your problem 2. Then pool hit rate and wait-queue length 3. Only then GC and allocation 4. Suspect the framework last

On trade-offs, my view is this: if nobody on the team owns this area long-term, do not introduce a second mechanism. With two coexistence you first have to work out which one is even in play when things break, and that costs far more than the performance you saved.

We also fixed monitoring along the way: replaced average-based alerts with percentiles and split them per endpoint. False alerts dropped by about seventy percent and the on-call rotation visibly cheered up.

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

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.

301 comments

301 comments

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

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

486
Ttang_hao·3 minutes ago

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

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

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

416
LlinlinMod·2 hours agoedited

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

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

389
Llinlin·12 minutes ago

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

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

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

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

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

351
Lli_ming·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".

345
Zzhou_yi·5 hours 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.

337
Mmike_xu·2 days agoedited

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.

208
Ttang_haoMod·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.

320
Bbob_chen·yesterday

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

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

289
Rran_bo·2 days ago

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

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

246
Nnikic·2 days ago

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

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

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

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

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

179
Bbob_chenOP·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.

97
Rran_bo·3 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.

139
Zzhu_zong·5 hours ago

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

78
Lli_ming·2 days ago

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

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

135
Nnikic·just now

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

473
Zzhou_yi·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
Oops_wang·5 hours 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".

126
Lli_ming·28 minutes ago

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

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

119
Rran_boOP·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.

97
KkiteOP·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
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.

111
Zzhou_yi·3 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.

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

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

101
Wwinter·2 days ago

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

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

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

80
KkiteOP·just nowedited

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.

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

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

64
Zzhu_zongOP·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
Sswoole_lee·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.

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

71
Ddev_zhou·2 days ago

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

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

366
Llinlin·28 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.

35
Oops_wang·2 days agoedited

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

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

92
Hhuang_keOP·2 days ago

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

1
Aalice_dev·2 days ago

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

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

28
KkiteMod·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.

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

203
Zzhou_yi·2 days ago

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

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

50
Mmike_xu·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".

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

13
Rrase·2 days ago

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

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

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

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

68
Rran_bo·2 days ago

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

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

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

47
Aalice_dev·2 hours ago

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

18
Sswoole_lee·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".

466
Ttang_hao·1 hour 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.

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

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

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

259
Zzhou_yi·2 days ago

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

40
Kkite·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".

138
Kkite·1 hour ago

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

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

21
Zzhou_yi·2 days ago

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

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

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

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

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

2
Nnikic·2 days ago

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

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

6
Ddev_zhou·1 hour agoedited

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.

463
Cchen_dev·28 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.

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

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

31
Mmike_xu·yesterday

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

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

401
Aalice_dev·3 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.

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

6
Lli_ming·2 days ago

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

334
Lli_ming·2 days agoedited

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.

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

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

432
Cchen_dev·12 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.

5
Mmike_xu·yesterday

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

29
Sswoole_leeOP·1 hour 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
Kkite·just now

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.

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

502
Kkernel_panic·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.

103
Kkite·2 days agoLevel 6

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

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

383
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".

1
Rrase·yesterday

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.

26
Cchen_devOP·just now

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

231
Mmike_xu·2 days agoLevel 6

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

1
Mmike_xu·2 hours ago

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

17
Sswoole_lee·2 days ago

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

29
Cchen_dev·2 days agoedited

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

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

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

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

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

1

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