ESP32 · Code review · Built a visual debugging panel for esp32-review over the weekend

376
ESr/esp32-review·posted by chen_dev·3 hours agoExperience

Built a visual debugging panel for esp32-review over the weekend

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.

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

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

639 votes total

218 comments

218 comments

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

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

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

475
Aalice_dev·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".

449
Oops_wangMod·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.

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

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

39
Rrase·2 days ago

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

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

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

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

119
Kkite·3 minutes ago

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

348
Oops_wang·2 days agoedited

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.

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

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

279
Oops_wang·2 days ago

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

242
Zzhou_yi·2 days ago

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

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

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

175
Bbob_chen·2 days agoedited

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

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

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

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

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

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

80
Zzhu_zong·12 minutes ago

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

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

470
Lli_ming·2 days ago

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

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

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

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

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

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

215
Aalice_dev·2 days agoLevel 6

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

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

91
Kkernel_panic·12 minutes agoedited

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.

2
Zzhou_yi·2 days agoeditedLevel 6

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.

502
Kkernel_panic·2 days agoLevel 6

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

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

37
Ttang_hao·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".

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

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

319
LlinlinOP·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".

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

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

314
Bbob_chen·2 days ago

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

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

2
Ttang_haoOP·2 days ago

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

176
Sswoole_leeMod·5 hours ago

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

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

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

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

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

3
LlinlinOP·5 hours ago

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

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

482
Zzhu_zong·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".

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

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

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

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

6
Rrase·3 minutes ago

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

478
Hhuang_ke·2 days ago

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

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

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

112
Kkernel_panic·yesterday

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

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

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

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

434
Zzhu_zong·2 days agoLevel 6

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

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

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

29
Sslow_query·5 hours ago

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

1
Llinlin·2 days agoedited

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

55
Rran_bo·2 days ago

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

49
Zzhu_zong·2 days ago

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

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

53
Nnikic·2 days ago

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

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

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

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

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

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

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

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

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

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

17
Llinlin·3 minutes agoedited

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

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

208
Hhuang_ke·28 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.

225
Zzhou_yi·2 days ago

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

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

73
Kkite·2 days ago

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

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

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

456
Aalice_dev·3 minutes agoedited

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

5
Zzhu_zong·2 days ago

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

17
Sslow_query·yesterday

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.

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

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

72
Zzhou_yi·2 days ago

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

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

4
Sslow_query·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".

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

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

405
LlinlinOP·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".

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

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

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

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

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

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

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

1
Nnikic·2 days agoedited

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

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

1
Bbob_chen·just now

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

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

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

1

This is the post detail page /en/c/esp32-review/post/p8. 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 →