Edge Computing · Resources · The edge cases the edge-computing-resources docs never spell out

640
ECr/edge-computing-resources·posted by swoole_lee·3 days agoAnnouncement

The edge cases the edge-computing-resources docs never spell out

Some background first. Our setup is edge-computing-resources plus three downstream services, seven figures of daily requests, peaking around nine in the evening.

-- The query that broke: a full scan over 20M rows.
-- A composite index took P99 from 1.8s down to 42ms.
SELECT id, title, created_at
  FROM posts
 WHERE community_id = ?
   AND status = 1
 ORDER BY score DESC
 LIMIT 20;

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.

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.

301 comments

301 comments

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

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

167
Kkernel_panic·3 minutes 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".

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

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

406
WwinterOP·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.

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

373
Oops_wang·28 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.

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

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

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

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

306
Rrase·2 hours ago

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

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

273
Wwinter·5 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.

225
Kkite·5 hours 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.

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

1
Zzhou_yiOP·2 days ago

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

1
Rran_bo·yesterday

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

65
Lli_mingOP·2 days ago

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

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

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

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

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

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

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

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

169
NnikicMod·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
Wwinter·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.

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

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

50
Cchen_dev·5 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.

10
Llinlin·2 days agoeditedLevel 6

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.

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

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

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

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

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

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

14
Kkite·2 days ago

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

321
Cchen_devOP·yesterday

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.

114
Bbob_chen·2 days ago

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

21
Rran_bo·2 days ago

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

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

73
Rran_bo·1 hour ago

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

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

57
Rran_bo·12 minutes 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.

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

190
Sslow_query·2 days ago

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

37
Wwinter·2 days ago

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

250
Sslow_query·just now

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.

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

5
Aalice_devMod·12 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.

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

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

1
Ttang_hao·2 days ago

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

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

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

225
Kkernel_panicOP·just nowedited

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

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

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

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

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

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

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

208
Sswoole_lee·2 days ago

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

207
Llinlin·2 days ago

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

194
Llinlin·2 days ago

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

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

77
Sslow_query·2 days ago

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

172
Bbob_chen·2 days ago

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

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

121
Ttang_hao·28 minutes 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".

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

364
Sslow_query·2 days agoedited

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

88
Wwinter·2 days ago

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

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

80
Zzhou_yiMod·just now

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

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

67
Oops_wang·12 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.

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

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

268
Rran_bo·2 days ago

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

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

130
Nnikic·2 days ago

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

17
Rran_bo·2 days ago

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

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

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

14
Hhuang_ke·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_devOP·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.

7
Hhuang_keOPMod·2 days ago

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

7
Hhuang_ke·yesterday

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

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

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

456
Aalice_devOP·2 days agoedited

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

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

39
Cchen_dev·just nowedited

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

30
Mmike_xu·28 minutes agoedited

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

134
Rran_boOP·5 hours 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.

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

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

52
Bbob_chen·2 hours agoedited

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

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

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

95
Zzhu_zong·2 days agoLevel 6

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

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

60
Rran_bo·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".

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

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

375
Llinlin·2 days ago

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

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

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

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

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

11
Ddev_zhou·3 minutes ago

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

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

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

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

4

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