Open Source · Blog · Ten open-source-blog anti-patterns — how many are you guilty of?

1.5K
OSr/open-source-blog·posted by ops_wang·32 minutes agoTooling

Ten open-source-blog anti-patterns — how many are you guilty of?

Some background first. Our setup is open-source-blog plus three downstream services, seven figures of daily requests, peaking around nine in the evening.

We also fixed monitoring along the way: replaced average-based alerts with percentiles and split them per endpoint. False alerts dropped by about seventy percent and the on-call rotation visibly cheered up.

Image placeholder · object storage in production
POST /api/uploads → CDN origin pull
788 comments

788 comments

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

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

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

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

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

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

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

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

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

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

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

335
KkiteOP·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.

218
LlinlinMod·28 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.

254
Rran_bo·just now

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

247
Aalice_devOP·yesterday

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

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

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

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

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

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

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

208
Aalice_dev·2 days ago

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

400
Ttang_haoOPMod·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.

96
Hhuang_ke·28 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.

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

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

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

406
Oops_wang·3 minutes ago

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

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

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

25
Zzhou_yiMod·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.

131
Kkernel_panic·2 days ago

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

273
Wwinter·just now

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

124
Wwinter·1 hour 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.

356
Cchen_devOP·2 days ago

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

87
Sswoole_leeOP·2 days ago

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

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

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

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

136
Zzhu_zongMod·2 days ago

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

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

66
Hhuang_ke·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".

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

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

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

248
Sswoole_lee·2 days agoLevel 6

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

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

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

310
Mmike_xu·2 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.

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

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

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

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

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

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

206
Ddev_zhouOPMod·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.

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

370
Zzhu_zong·2 days ago

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

120
Rrase·2 days agoedited

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

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

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

102
Lli_ming·2 days ago

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

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

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

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

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

59
Zzhou_yi·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".

40
Rran_bo·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
Lli_ming·2 days ago

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

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

27
Llinlin·2 days ago

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

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

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

9
KkiteMod·3 minutes 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.

17
Hhuang_ke·2 days ago

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

12
Kkernel_panic·2 days ago

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

11
Nnikic·28 minutes ago

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

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

7
Zzhou_yi·just now

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.

6
Zzhou_yi·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".

153
Oops_wang·12 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.

58
Ddev_zhou·1 hour agoedited

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

437
Aalice_dev·2 days ago

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

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

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

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

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

86
Aalice_dev·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
Ddev_zhouOP·3 minutes ago

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

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

212
Zzhou_yi·2 days agoLevel 6

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

326
Llinlin·2 days agoeditedLevel 6

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

314
Aalice_dev·3 minutes agoeditedLevel 6

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

92
Kkernel_panic·2 days agoLevel 6

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

34
Aalice_dev·2 days ago

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

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

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

495
Llinlin·12 minutes 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.

100
Sswoole_lee·28 minutes 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".

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

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

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

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

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

89
Cchen_dev·2 days agoeditedLevel 6

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

14
Rran_bo·3 minutes ago

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

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

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

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

214
Lli_ming·2 days ago

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

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

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

5
Aalice_dev·28 minutes ago

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

2
Ddev_zhouMod·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
Ttang_hao·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.

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

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

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

1
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

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