Edge Computing · Showcase · Why this edge-computing-show pattern gets slow in production: a source-level explanation

1.8K
ECr/edge-computing-show·posted by ran_bo·6 hours agoPostmortem

Why this edge-computing-show pattern gets slow in production: a source-level explanation

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.

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.

Sstackoverflow.comExternal link · opens in a new tab
994 comments

994 comments

· first 120 loaded
M
Mmike_xu·2 days ago

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

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

486
Cchen_dev·3 minutes ago

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

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

412
Sswoole_leeOPMod·2 hours ago

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

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

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

89
Zzhou_yi·2 days agoedited

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

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

147
Lli_ming·2 days ago

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

472
Sslow_query·2 days ago

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

387
Llinlin·2 days ago

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

383
Bbob_chen·2 days ago

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

367
Bbob_chen·2 days ago

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

344
Zzhu_zong·2 days ago

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

271
Rrase·28 minutes ago

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

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

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

419
Mmike_xu·just now

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

402
Oops_wangOP·2 days ago

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

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

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

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

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

15
Mmike_xu·2 days ago

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

37
Oops_wangOP·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.

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

290
Aalice_devMod·2 days ago

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

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

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

416
Zzhou_yi·5 hours ago

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

31
Nnikic·2 days ago

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

72
Cchen_devMod·2 days ago

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

46
Hhuang_ke·2 days ago

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

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

42
RraseOPMod·3 minutes ago

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

246
Zzhou_yi·yesterday

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

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

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

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

303
Bbob_chenOP·2 days ago

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

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

245
Rrase·2 days ago

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

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

24
Sslow_query·2 days ago

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

216
Sswoole_leeOP·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.

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

205
Aalice_dev·just now

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

122
Llinlin·2 days agoedited

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

189
Ddev_zhou·2 days ago

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

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

181
Hhuang_ke·just nowedited

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.

183
Wwinter·2 days ago

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

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

339
Rran_bo·2 days ago

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

116
Lli_ming·5 hours 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.

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

171
Nnikic·12 minutes ago

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

152
Aalice_dev·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.

255
Sslow_query·2 days ago

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

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

138
Llinlin·2 days agoedited

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

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

55
Llinlin·2 days ago

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

121
Bbob_chenOP·2 days ago

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

494
Lli_ming·2 days ago

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

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

59
Llinlin·2 days agoedited

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

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

41
Sswoole_lee·1 hour ago

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

50
Sswoole_leeOP·2 days ago

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

181
Oops_wangMod·just nowedited

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

166
Rrase·2 days ago

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

160
Rran_boMod·2 days ago

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

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

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

133
Llinlin·5 hours ago

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

109
Rrase·2 days ago

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

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

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

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

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

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

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

24
Ddev_zhou·2 days ago

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

223
Hhuang_keOP·just now

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

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

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

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

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

495
Kkernel_panic·2 days ago

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

70
Sslow_query·2 days agoedited

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

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

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

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

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

100
Rrase·2 days ago

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

46
Zzhou_yi·2 days ago

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

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

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

38
Hhuang_ke·2 days ago

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

30
Wwinter·3 minutes 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.

188
Cchen_dev·2 days ago

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

30
Mmike_xu·2 days ago

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

23
Zzhou_yi·2 days ago

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

73
Aalice_dev·yesterday

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.

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

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

14
Ddev_zhou·3 minutes ago

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

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

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

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

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

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

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

1
Kkernel_panic·28 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.

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

1
Aalice_dev·2 days ago

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

1

This is the post detail page /en/c/edge-computing-show/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 →