Open Source · Blog · Choosing open-source-blog: I turned 5 options into a side-by-side comparison

500
OSr/open-source-blog·posted by ran_bo·5 minutes agoInternals

Choosing open-source-blog: I turned 5 options into a side-by-side comparison

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.

On trade-offs, my view is this: if nobody on the team owns this area long-term, do not introduce a second mechanism. With two coexistence you first have to work out which one is even in play when things break, and that costs far more than the performance you saved.

Bblog.cloudflare.comExternal link · opens in a new tab
266 comments

266 comments

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

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

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

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

468
Lli_ming·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".

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

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

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

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

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

109
Sswoole_lee·2 days ago

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

428
Lli_ming·2 days ago

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

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

408
Zzhou_yi·yesterday

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

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

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

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

277
Llinlin·2 days agoedited

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

315
Kkite·2 days ago

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

336
Mmike_xu·2 days ago

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

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

484
Mmike_xu·2 days ago

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

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

11
Sslow_query·yesterdayedited

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

320
Ttang_hao·2 days ago

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

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

324
Kkernel_panic·3 minutes agoedited

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

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

16
Cchen_devOP·2 days agoedited

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

435
Cchen_devMod·2 days ago

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

321
Ttang_hao·2 days ago

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

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

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

280
Zzhou_yi·28 minutes 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.

268
Rrase·2 days ago

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

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

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

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

22
Sswoole_leeOP·2 days ago

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

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

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

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

192
Oops_wangMod·12 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.

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

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

168
Hhuang_keOP·1 hour 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.

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

144
Hhuang_ke·1 hour agoedited

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

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

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

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

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

75
Cchen_dev·just nowedited

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.

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

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

109
KkiteMod·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
Kkernel_panicOP·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

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

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

348
Bbob_chenOP·2 days agoedited

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

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

424
Sslow_queryOP·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
Mmike_xu·3 minutes agoLevel 6

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.

70
Bbob_chen·1 hour agoedited

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.

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

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

126
Aalice_devOP·2 days ago

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

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

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

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

105
Ddev_zhou·just now

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

104
Ttang_hao·yesterday

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.

158
Aalice_dev·28 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.

62
KkiteOP·2 hours 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".

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

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

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

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

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

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

1
Oops_wang·28 minutes ago

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

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

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

1
Kkite·2 days ago

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

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

24
Sslow_query·3 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.

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

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

22
Wwinter·2 days ago

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

2
Nnikic·2 days ago

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

42
Lli_ming·just nowedited

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.

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

13
Ddev_zhou·2 days ago

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

224
Mmike_xu·1 hour 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.

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

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

158
Hhuang_ke·2 hours ago

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

6
Rran_bo·28 minutes ago

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

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

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

279
Llinlin·yesterdayedited

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.

33
Lli_ming·3 minutes agoeditedLevel 6

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.

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

2
Cchen_dev·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".

18
Wwinter·1 hour ago

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

13
Rran_bo·2 days ago

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

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

15
Rrase·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
Oops_wangMod·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.

61
Sslow_query·2 days agoedited

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

13
Aalice_dev·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".

13
Mmike_xu·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".

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

7
Hhuang_ke·2 days ago

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

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

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

1
Llinlin·2 days ago

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

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

28

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