Capacitor · Ops · The capacitor-ops execution flow in one diagram (with sequence chart)

608
CAr/capacitor-ops·posted by kite·5 minutes agoPostmortemLocked

The capacitor-ops execution flow in one diagram (with sequence chart)

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 capacitor-ops 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%

1034 votes total

201 comments

201 comments

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

495
Rran_bo·just now

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

157
Lli_ming·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
Sslow_query·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.

439
Bbob_chen·2 days ago

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

433
RraseOP·1 hour ago

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

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

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

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

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

1
Aalice_dev·2 days ago

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

1
Nnikic·2 days agoedited

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

4
Hhuang_ke·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
Rrase·2 days ago

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

237
Wwinter·2 days agoedited

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

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

397
Lli_ming·2 days agoedited

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

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

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

367
Bbob_chen·2 days ago

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

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

2
Llinlin·2 days ago

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

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

339
Ttang_hao·1 hour ago

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

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

25
Mmike_xu·2 days ago

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

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

34
Sslow_query·2 days ago

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

23
Hhuang_ke·just nowedited

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

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

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

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

81
Mmike_xu·2 days ago

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

30
Zzhou_yi·yesterday

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

20
Nnikic·2 days ago

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

304
Wwinter·2 hours ago

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

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

229
Sswoole_lee·2 days agoedited

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

176
Rran_bo·28 minutes ago

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

154
Hhuang_ke·yesterday

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.

341
Ddev_zhou·yesterday

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.

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

493
Hhuang_ke·2 days agoLevel 6

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

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

2
Kkernel_panicMod·2 days ago

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

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

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

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

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

295
Mmike_xuOP·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.

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

277
Mmike_xu·2 days ago

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

260
Zzhu_zongOP·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.

190
Llinlin·2 days ago

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

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

237
Oops_wang·yesterday

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

76
Zzhu_zong·2 days ago

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

225
Wwinter·2 days ago

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

220
Mmike_xu·12 minutes agoedited

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

202
Rran_bo·5 hours ago

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

157
Llinlin·2 days ago

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

28
Kkite·just nowedited

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

97
Bbob_chenMod·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.

85
Sswoole_lee·just now

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

73
Nnikic·2 days ago

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

73
Sslow_queryOP·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
Mmike_xu·2 days ago

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

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

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

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

53
Kkite·yesterday

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

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

325
Zzhou_yi·2 days ago

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

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

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

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

122
Rran_bo·2 days ago

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

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

143
Ddev_zhou·12 minutes ago

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

54
Cchen_dev·28 minutes ago

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

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

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

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

23
Bbob_chen·2 days agoLevel 6

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

82
Lli_ming·yesterday

One counter-example: below capacitor-ops 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
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.

155
Rran_bo·2 days ago

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

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

415
Rrase·2 days agoLevel 6

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

317
Nnikic·2 days ago

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

1
Cchen_dev·just now

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.

47
Ddev_zhou·2 days ago

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

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

33
Wwinter·2 days ago

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

11
Zzhou_yi·2 days ago

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

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

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

12
Kkernel_panic·2 hours ago

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

10
Cchen_dev·2 days ago

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

4
Wwinter·28 minutes ago

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

3
Zzhou_yiMod·1 hour ago

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

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

195
Wwinter·3 minutes ago

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

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

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

501
Sslow_queryMod·2 days ago

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

112
Kkernel_panic·2 days ago

One counter-example: below capacitor-ops 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
WwinterOP·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.

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

80
Aalice_dev·yesterday

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

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

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

5
Mmike_xu·3 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.

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

333
Ttang_hao·2 days ago

One counter-example: below capacitor-ops 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

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

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.

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

28

This is the post detail page /en/c/capacitor-ops/post/p13. 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 →