Capacitor · Ops · capacitor-ops logging: what separates "readable" from "usable"

1.2K
CAr/capacitor-ops·posted by alice_dev·32 minutes agoTooling

capacitor-ops logging: what separates "readable" from "usable"

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.

One last trap: in container environments remember to adjust the memory-related parameters in step. Otherwise the host limit and the process expectation disagree, and the symptom is intermittent, unreproducible failure.

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

Ddeveloper.mozilla.orgExternal link · opens in a new tab
122 comments

122 comments

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

517
Oops_wang·2 days ago

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

146
Rran_boOP·2 days ago

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

131
Cchen_dev·5 hours ago

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

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

331
Mmike_xuOP·2 days agoedited

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

139
KkiteOP·28 minutes ago

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

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

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

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

28
Zzhou_yi·1 hour 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.

419
Sswoole_leeOP·2 days agoedited

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

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

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

454
NnikicMod·12 minutes agoedited

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

127
Rran_bo·2 hours ago

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

144
Mmike_xu·2 days ago

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

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

510
Oops_wang·2 days ago

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

31
Oops_wangOP·1 hour agoedited

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.

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

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

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

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

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

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

358
Rrase·2 days ago

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

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

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

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

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

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

286
Rran_boOP·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".

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

82
Wwinter·2 days ago

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

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

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

13
Hhuang_ke·1 hour 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.

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

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

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

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

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

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

153
Mmike_xu·12 minutes ago

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

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

438
Llinlin·just now

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

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

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

112
Llinlin·2 days agoedited

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

418
Kkernel_panicOP·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.

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

353
Lli_ming·2 days ago

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

389
Oops_wang·2 days ago

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

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

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

304
Ttang_hao·2 days ago

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

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

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

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

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

75
WwinterMod·2 days ago

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

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

174
Wwinter·2 days agoedited

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

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

225
Ttang_haoMod·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.

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

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

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

217
Llinlin·28 minutes ago

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

186
RraseOP·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.

118
Oops_wang·2 days ago

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

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

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

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

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

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

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

458
Nnikic·3 minutes 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.

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

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

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

33
Sslow_query·2 days ago

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

52
Aalice_dev·28 minutes 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".

5
Hhuang_keMod·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
Bbob_chen·2 days ago

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

28
Kkernel_panic·28 minutes ago

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

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

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

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

22
Sswoole_lee·yesterdayedited

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.

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

11
Lli_ming·just now

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.

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

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

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

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

271
Kkernel_panicOP·2 days ago

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

278
Kkite·2 hours 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".

10
NnikicMod·1 hour 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
Hhuang_keMod·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".

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

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

103
Llinlin·2 days ago

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

80
Hhuang_keOP·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.

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

220
Mmike_xu·2 days ago

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

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

5
Llinlin·2 days ago

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

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

485
Rrase·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".

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

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

343
Cchen_devMod·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.

143
Nnikic·2 days agoedited

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

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

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

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

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

1
Hhuang_ke·2 days ago

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

1

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