SWC · Interviews · Built a visual debugging panel for swc-interview over the weekend

1.3K
SWr/swc-interview·posted by linlin·6 hours agoAnnouncementLocked

Built a visual debugging panel for swc-interview over the weekend

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

What genuinely surprised me was the tail. The average looked great while P99 jumped by an order of magnitude past some threshold. The cause was not swc-interview itself but our upstream connection reuse — the load test traffic was too clean and hid the long-tail requests.

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

2171 votes total

504 comments

504 comments

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

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

399
Hhuang_keOP·3 minutes ago

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

332
Kkite·yesterdayedited

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.

164
Oops_wang·2 days ago

One counter-example: below swc-interview 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
Kkernel_panic·2 days ago

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

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

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

212
Hhuang_keMod·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.

192
Rrase·2 days ago

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

412
Lli_ming·2 days ago

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

190
Kkite·2 days ago

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

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

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

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

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

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

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

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

78
Cchen_dev·3 minutes ago

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

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

138
Cchen_dev·2 days ago

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

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

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

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

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

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

202
Hhuang_keMod·5 hours ago

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

76
Aalice_dev·28 minutes ago

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

74
Kkite·2 days ago

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

352
Kkernel_panic·5 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.

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

397
LlinlinOP·just now

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

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

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

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

40
Aalice_dev·2 days ago

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

39
Rrase·2 days agoedited

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

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

39
Oops_wang·2 days ago

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

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

37
Sslow_query·2 days ago

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

486
Ddev_zhou·2 days ago

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

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

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

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

140
Lli_ming·12 minutes ago

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

28
Bbob_chen·just now

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

2
Sswoole_lee·just now

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.

14
Sswoole_leeOP·3 minutes ago

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

480
Nnikic·2 days agoedited

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

467
Nnikic·2 days ago

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

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

60
Aalice_dev·2 days agoLevel 6

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

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

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

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

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

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

429
Sslow_query·yesterday

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

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

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

425
Ddev_zhouOP·2 days ago

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

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

50
NnikicOP·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 ago

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

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

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

39
Zzhu_zongOP·28 minutes 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.

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

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

36
Hhuang_keOP·2 days ago

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

223
Sswoole_leeOP·2 days ago

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

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

14
Zzhou_yi·2 days ago

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

329
Bbob_chenOP·12 minutes ago

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

28
Aalice_devOP·2 days agoedited

One counter-example: below swc-interview 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
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.

1
Nnikic·2 hours ago

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

3
Zzhou_yi·1 hour ago

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

268
Wwinter·1 hour ago

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

3
Kkernel_panic·2 days ago

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

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

23
Wwinter·yesterday

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

215
Ddev_zhou·2 hours ago

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

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

39
Cchen_dev·2 days agoeditedLevel 6

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

324
Oops_wang·2 days agoeditedLevel 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.

165
Rran_bo·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
Lli_ming·2 hours agoLevel 6

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

49
Kkernel_panic·2 days ago

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

67
Rran_bo·2 days ago

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

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

14
Zzhou_yi·2 days agoedited

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

406
Llinlin·yesterdayedited

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

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

3
Zzhu_zong·just now

One counter-example: below swc-interview 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
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.

9
Cchen_dev·2 days ago

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

91
Kkernel_panic·2 days ago

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

8
Nnikic·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
NnikicMod·2 days agoedited

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

282
Sslow_query·2 days ago

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

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

6
Zzhu_zong·2 days ago

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

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

14
Aalice_dev·2 days ago

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

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

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

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

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

129
Llinlin·2 days ago

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

35
Ddev_zhou·3 minutes ago

One counter-example: below swc-interview 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
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.

63
Bbob_chen·2 days ago

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

285
Hhuang_ke·3 minutes agoedited

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

172
Sswoole_lee·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
Aalice_dev·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.

1
Cchen_devMod·2 hours agoedited

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

218
RraseMod·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.

1

This is the post detail page /en/c/swc-interview/post/p7. 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 →