Kafka · English · Built a visual debugging panel for kafka-en over the weekend

2.2K
KAr/kafka-en·posted by bob_chen·2 days agoReview

Built a visual debugging panel for kafka-en 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".

Image placeholder · object storage in production
POST /api/uploads → CDN origin pull
1224 comments

1224 comments

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

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

471
Hhuang_ke·2 days ago

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

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

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

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

219
KkiteOP·3 minutes 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.

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

497
Llinlin·1 hour ago

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

426
Mmike_xu·2 hours ago

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

497
Kkite·2 hours ago

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

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

415
Rran_bo·2 days ago

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

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

133
Ddev_zhou·2 days ago

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

514
Mmike_xu·2 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.

410
Ttang_hao·2 days agoeditedLevel 6

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

178
Rran_bo·yesterday

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

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

29
Zzhou_yi·2 days ago

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

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

416
Bbob_chen·2 days ago

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

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

381
Cchen_dev·1 hour ago

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

362
NnikicOP·1 hour ago

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

300
Hhuang_ke·2 days ago

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

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

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

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

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

7
Lli_ming·2 days ago

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

5
Nnikic·2 days ago

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

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

37
Mmike_xu·2 days ago

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

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

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

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

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

259
Rrase·2 days ago

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

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

200
Sswoole_leeMod·2 days ago

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

193
Nnikic·2 days ago

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

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

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

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

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

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

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

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

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

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

123
Kkite·2 days ago

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

110
LlinlinOP·2 days ago

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

46
Cchen_dev·28 minutes agoedited

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

84
Aalice_devOP·3 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.

42
Kkite·2 days ago

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

258
Sswoole_lee·2 days ago

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

2
Sswoole_lee·28 minutes ago

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

101
Zzhu_zong·3 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.

97
Lli_ming·2 days ago

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

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

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

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

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

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

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

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

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

59
Zzhou_yi·2 days ago

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

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

48
Kkernel_panic·2 days ago

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

129
Cchen_devMod·2 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.

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

4
Lli_ming·3 minutes agoedited

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

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

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

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

19
Llinlin·2 days ago

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

165
Cchen_dev·yesterday

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

2
Cchen_dev·2 days ago

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

53
Llinlin·2 days ago

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

450
Oops_wang·2 days ago

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

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

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

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

209
Kkite·1 hour ago

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

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

247
Hhuang_ke·2 days ago

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

64
Zzhou_yi·2 days ago

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

66
Sslow_query·2 days ago

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

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

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

47
Oops_wang·2 days ago

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

22
Zzhu_zong·2 days ago

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

329
Oops_wang·2 days agoLevel 6

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

10
Llinlin·2 days ago

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

288
Kkite·2 days agoLevel 6

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

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

4
Sswoole_lee·2 days ago

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

41
Hhuang_ke·2 days ago

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

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

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

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

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

475
Wwinter·28 minutes ago

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

8
Kkite·yesterdayedited

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

464
Wwinter·just now

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

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

14
Hhuang_ke·2 days agoedited

One counter-example: below kafka-en 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
Hhuang_ke·1 hour ago

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

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

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

315
Hhuang_ke·2 days ago

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

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

2
Ddev_zhou·2 days ago

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

2
Sswoole_lee·yesterdayedited

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

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

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

1
Zzhu_zong·2 days ago

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

1

This is the post detail page /en/c/kafka-en/post/p4. 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 →