ESP32 · Code review · Why does esp32-review use twice the memory of comparable tools?

454
ESr/esp32-review·posted by ran_bo·5 minutes agoTooling

Why does esp32-review use twice the memory of comparable tools?

Most esp32-review articles stop at "how to use it" and never cover "when not to use it". This is an attempt at the second half.

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.

Self-host — full control44%
Managed service — less work28%
Hybrid: core self-hosted17%
Not decided yet11%

772 votes total

228 comments

228 comments

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

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

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

520
Lli_ming·2 days agoedited

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

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

311
Ddev_zhouOP·2 days agoeditedLevel 6

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

454
Ttang_hao·2 days ago

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

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

2
Ddev_zhou·2 days agoeditedLevel 6

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

314
Lli_mingOP·3 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.

327
Kkite·28 minutes ago

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

72
Ttang_haoOP·2 days ago

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

239
Ttang_hao·12 minutes ago

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

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

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

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

47
Llinlin·5 hours ago

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

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

164
Lli_mingMod·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.

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

141
Nnikic·2 days agoLevel 6

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

80
Wwinter·3 minutes agoeditedLevel 6

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

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

1
Ttang_hao·2 days agoLevel 6

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

1
Sslow_query·just now

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

20
Hhuang_keMod·2 days ago

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

57
Zzhu_zong·5 hours ago

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

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

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

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

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

414
Rrase·just nowedited

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

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

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

374
Lli_ming·2 days ago

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

143
KkiteOP·2 days ago

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

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

1
Zzhou_yi·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
Lli_ming·2 days ago

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

79
Kkernel_panic·2 days agoedited

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

397
NnikicOP·2 days ago

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

334
Bbob_chen·2 days ago

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

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

364
Mmike_xu·just now

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

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

54
Kkite·2 days ago

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

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

353
Oops_wang·2 days ago

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

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

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

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

435
Ddev_zhouOP·2 days ago

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

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

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

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

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

214
Ttang_hao·just now

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

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

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

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

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

400
Bbob_chen·just now

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

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

340
Zzhu_zong·2 days ago

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

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

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

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

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

448
Rrase·2 days ago

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

166
Sswoole_leeMod·2 days agoedited

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

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

167
Kkite·5 hours ago

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

160
Ddev_zhou·2 hours ago

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

367
Rran_bo·2 days ago

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

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

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

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

249
Sswoole_lee·2 hours ago

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

140
Rran_bo·5 hours ago

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

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

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

128
Rran_bo·3 minutes ago

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

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

122
Wwinter·2 days ago

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

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

5
Aalice_dev·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
Cchen_dev·2 days ago

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

378
Nnikic·2 days ago

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

283
Oops_wangOP·3 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.

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

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

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

76
Kkernel_panic·just now

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

68
Ddev_zhouOP·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.

5
Sslow_query·2 days agoedited

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

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

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

41
Sslow_query·12 minutes ago

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

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

461
RraseOP·1 hour ago

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

77
Oops_wang·2 days agoedited

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

31
Cchen_dev·2 days ago

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

1
Ttang_hao·2 days ago

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

28
Rrase·2 days ago

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

23
Sslow_query·2 days ago

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

10
Rran_bo·2 days agoedited

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

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

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

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

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

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

6
Lli_ming·2 days ago

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

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

4
Rrase·5 hours ago

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

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

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

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

2
Hhuang_ke·28 minutes agoedited

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

506
KkiteOP·5 hours ago

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

259
Nnikic·2 days ago

I just read the esp32-review 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/esp32-review/post/p11. 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 →