Open Source · Blog · Those easily-missed type details in open-source-blog

227
OSr/open-source-blog·posted by zhu_zong·1 hour agoExperience

Those easily-missed type details in open-source-blog

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

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

386 votes total

94 comments

94 comments

M
Wwinter·3 minutes ago

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

514
Rrase·1 hour ago

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

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

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

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

419
Kkite·28 minutes ago

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

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

40
Kkite·1 hour 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.

19
Cchen_dev·2 days ago

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

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

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

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

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

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

451
Bbob_chen·5 hours ago

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

447
Llinlin·12 minutes ago

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

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

272
Kkernel_panicOP·2 hours 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.

198
Rran_bo·2 days agoedited

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

221
Sslow_query·2 days ago

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

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

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

179
Hhuang_ke·2 days ago

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

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

170
Wwinter·2 days agoedited

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

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

98
Bbob_chen·yesterday

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.

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

30
Hhuang_ke·2 days ago

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

90
Wwinter·2 days ago

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

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

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

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

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

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

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

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

42
Ddev_zhou·28 minutes ago

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

81
Bbob_chen·12 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.

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

180
Mmike_xu·2 days ago

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

46
Ddev_zhou·2 days ago

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

61
Rrase·5 hours ago

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

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

439
Cchen_dev·2 days agoedited

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

46
Zzhu_zong·12 minutes ago

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

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

272
Zzhu_zong·2 days ago

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

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

139
Cchen_dev·5 hours 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.

302
Sslow_query·5 hours agoedited

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

33
Sslow_query·5 hours 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.

265
Llinlin·2 days ago

One counter-example: below open-source-blog 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
Sswoole_lee·just nowLevel 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.

239
Bbob_chen·28 minutes agoedited

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

20
Zzhu_zong·2 days ago

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

18
Ddev_zhou·12 minutes ago

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

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

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

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

403
Hhuang_keOP·2 days ago

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

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

269
Wwinter·2 days ago

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

64
Rran_bo·2 days ago

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

271
WwinterOP·2 days agoLevel 6

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

31
Aalice_dev·2 days ago

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

254
Sslow_query·2 days ago

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

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

239
Rran_boMod·2 days ago

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

19
Ddev_zhou·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
Kkernel_panic·2 days ago

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

173
Aalice_dev·12 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.

83
Oops_wang·5 hours ago

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

249
Nnikic·2 days agoedited

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

166
Llinlin·2 days agoLevel 6

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

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

2
Wwinter·2 days agoeditedLevel 6

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.

429
Zzhu_zong·1 hour ago

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

216
Lli_ming·2 days ago

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

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

101
Zzhu_zong·2 days agoLevel 6

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

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

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

35
Nnikic·2 days ago

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

11
Sswoole_lee·2 days ago

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

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

4
Sslow_queryMod·2 days ago

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

7
Lli_ming·just now

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

6
Zzhu_zongOP·5 hours ago

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

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

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

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

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

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

1

This is the post detail page /en/c/open-source-blog/post/p5. 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 →