CLI Tools · Career · Interview notes: how I answered a question about the cli-tools-career concurrency model

784
CTr/cli-tools-career·posted by tang_hao·5 minutes agoJobs

Interview notes: how I answered a question about the cli-tools-career concurrency model

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.

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 cli-tools-career itself but our upstream connection reuse — the load test traffic was too clean and hid the long-tail requests.

Documentation first44%
Source code first28%
Just ask someone17%
Run a demo and learn by error11%

1333 votes total

427 comments

427 comments

· first 120 loaded
M
Cchen_devOPMod·2 days agoedited

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

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

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

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

391
Sslow_queryOP·28 minutes ago

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

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

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

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

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

97
Mmike_xu·2 days ago

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

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

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

334
Mmike_xu·2 days ago

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

328
Bbob_chen·2 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.

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

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

2
Ddev_zhou·yesterday

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

92
Bbob_chen·2 days ago

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

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

316
Mmike_xu·2 days ago

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

24
Wwinter·1 hour ago

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

307
Kkernel_panic·2 days ago

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

305
Hhuang_ke·2 days ago

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

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

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

510
Kkernel_panicOP·28 minutes ago

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

44
Cchen_dev·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
Rrase·2 days ago

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

9
Nnikic·2 days agoLevel 6

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

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

228
Kkernel_panic·2 days agoedited

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

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

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

299
NnikicMod·3 minutes ago

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

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

279
Zzhu_zong·2 days agoedited

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

253
Cchen_dev·2 days ago

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

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

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

102
Kkite·2 hours ago

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

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

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

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

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

224
Rran_bo·2 days agoedited

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

291
Sslow_query·yesterdayedited

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

148
Rran_bo·2 days ago

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

476
Rran_bo·5 hours ago

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

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

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

133
Ttang_hao·5 hours agoLevel 6

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
Llinlin·2 days ago

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

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

8
Sslow_query·2 days ago

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

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

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

250
Mmike_xu·2 days agoLevel 6

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

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

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

39
Oops_wang·2 days agoedited

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

138
Mmike_xu·2 days ago

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

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

3
Kkernel_panic·just now

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
Hhuang_keOP·5 hours ago

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

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

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

318
Aalice_devOP·28 minutes ago

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

1
Nnikic·just now

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.

68
Cchen_dev·12 minutes ago

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

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

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

6
Kkernel_panic·yesterday

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

1
Oops_wang·2 hours ago

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

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

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

137
Llinlin·2 days agoLevel 6

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

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

193
Zzhou_yi·2 days agoeditedLevel 6

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

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

146
Zzhou_yi·28 minutes ago

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

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

207
Hhuang_ke·2 days agoLevel 6

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

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

3
Rran_bo·2 hours agoeditedLevel 6

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

126
Zzhu_zong·2 hours agoLevel 6

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

15
Hhuang_ke·3 minutes 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.

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

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

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

20
LlinlinOP·yesterday

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

6
Zzhou_yi·2 days ago

One counter-example: below cli-tools-career 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
Kkernel_panic·1 hour agoedited

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

47
Hhuang_ke·12 minutes ago

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

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

43
Ddev_zhou·2 days ago

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

31
Lli_ming·2 days 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.

251
Sswoole_lee·2 days ago

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

27
Rran_bo·3 minutes ago

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

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

32
Lli_ming·1 hour ago

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

22
Lli_ming·5 hours ago

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

12
Aalice_dev·2 days ago

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

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

10
Zzhou_yi·2 days ago

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

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

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

6
Ttang_hao·2 days ago

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

6
Cchen_dev·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
Sswoole_lee·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.

3
Cchen_dev·5 hours ago

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

2
Lli_ming·yesterday

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

2
Zzhou_yi·2 days ago

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

2
Llinlin·2 days ago

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

2
Oops_wang·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
Zzhou_yi·1 hour ago

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

247
Mmike_xu·2 days ago

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

144
Ttang_haoOP·2 days ago

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

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

318

This is the post detail page /en/c/cli-tools-career/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 →