Edge Computing · Resources · Those easily-missed type details in edge-computing-resources

1.5K
ECr/edge-computing-resources·posted by rase·3 days agoPostmortem

Those easily-missed type details in edge-computing-resources

Short version: edge-computing-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.

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.

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

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.

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.

801 comments

801 comments

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

488
Bbob_chen·5 hours ago

One counter-example: below edge-computing-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.

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

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

1
Sslow_query·2 days ago

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

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

112
Hhuang_keOP·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.

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

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

446
Cchen_dev·2 hours ago

One counter-example: below edge-computing-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.

435
Ttang_hao·12 minutes ago

One counter-example: below edge-computing-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.

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

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

367
Ttang_hao·yesterday

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

349
Oops_wang·2 days ago

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

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

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

28
Llinlin·3 minutes ago

One counter-example: below edge-computing-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.

355
WwinterMod·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.

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

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

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

260
Sswoole_lee·1 hour 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
Aalice_dev·12 minutes ago

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

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

147
Zzhou_yiOP·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.

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

58
Llinlin·28 minutes agoedited

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

185
Sswoole_lee·1 hour agoedited

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

94
Wwinter·2 days ago

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

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

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

130
Rrase·2 days agoedited

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

112
Zzhou_yi·5 hours ago

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

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

110
Zzhu_zong·2 days ago

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

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

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

97
Zzhou_yiOP·just now

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.

26
Aalice_dev·2 days ago

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

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

102
Hhuang_ke·1 hour ago

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

69
Oops_wang·1 hour ago

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

220
Ddev_zhou·yesterday

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

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

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

365
Kkite·28 minutes 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.

323
Sslow_query·2 days agoedited

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

17
Ttang_hao·2 days ago

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

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

384
Cchen_dev·2 hours ago

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

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

444
Ddev_zhou·2 days ago

One counter-example: below edge-computing-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.

115
Lli_mingMod·2 days ago

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

57
Nnikic·2 days ago

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

9
Aalice_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.

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

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

364
Wwinter·2 days ago

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

441
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
Kkite·yesterday

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

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

15
Hhuang_ke·just nowLevel 6

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

2
Ttang_haoOP·28 minutes 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.

303
Zzhu_zong·2 days ago

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

226
Aalice_dev·2 days agoLevel 6

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

219
Nnikic·2 days agoLevel 6

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

47
Lli_ming·2 days ago

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

1
Bbob_chen·2 days agoedited

One counter-example: below edge-computing-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.

97
Wwinter·2 hours ago

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

123
Oops_wang·2 days ago

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

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

16
Ddev_zhou·2 hours ago

One counter-example: below edge-computing-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
Hhuang_ke·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.

485
Ttang_hao·2 days agoLevel 6

One counter-example: below edge-computing-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.

111
Rran_bo·2 days ago

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

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.

13
Sswoole_lee·2 days ago

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

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

314
Lli_ming·28 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.

452
Sslow_queryMod·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
Kkite·yesterday

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

62
Cchen_dev·28 minutes ago

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

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

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

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

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

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

414
Nnikic·5 hours ago

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

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

6
RraseOP·2 days ago

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

8
Sswoole_lee·2 days ago

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

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

2
Kkite·2 days ago

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

51
Sslow_query·2 days ago

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

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

49
Zzhu_zong·2 days ago

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

41
Hhuang_keOP·2 days ago

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

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

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

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

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

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

13
Rrase·2 days ago

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

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

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

7
Wwinter·2 days ago

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

6
Ttang_hao·2 days ago

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

4
Ddev_zhouMod·2 days ago

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

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

30
Sslow_query·2 days ago

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

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

1
Mmike_xu·2 days ago

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

38
Oops_wang·3 minutes ago

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

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

461
Llinlin·2 days ago

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

1
Hhuang_ke·2 days agoedited

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

1
Llinlin·2 days ago

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

1

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