Monorepo Frontend · Q&A · Those easily-missed type details in monorepo-frontend-qa

168
MFr/monorepo-frontend-qa·posted by bob_chen·3 days agoOpen sourceLocked

Those easily-missed type details in monorepo-frontend-qa

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.

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.

Performance44%
Maintainability28%
Ecosystem and community17%
Hiring difficulty11%

286 votes total

75 comments

75 comments

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

481
Mmike_xu·1 hour ago

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

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

362
Sslow_queryOP·yesterdayedited

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.

320
Sswoole_lee·just now

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

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

382
Sslow_query·12 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.

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

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

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

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

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

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

171
Mmike_xu·just now

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

30
Mmike_xu·28 minutes 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.

18
Aalice_devMod·3 minutes ago

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

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

318
Rrase·2 days ago

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

239
KkiteOP·2 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.

178
Sslow_query·2 days ago

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

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

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

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

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

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

54
Ttang_hao·28 minutes ago

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

1
Hhuang_ke·2 days agoedited

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

202
Zzhou_yiOP·2 days ago

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

133
NnikicOP·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.

126
Rrase·3 minutes ago

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

145
Aalice_dev·3 minutes ago

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

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

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

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

511
Zzhou_yi·12 minutes ago

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

334
Oops_wang·2 hours ago

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

471
LlinlinMod·12 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.

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

4
Llinlin·2 days agoeditedLevel 6

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

92
Mmike_xu·just nowLevel 6

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

25
Sslow_query·2 hours ago

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

83
Sslow_query·2 days ago

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

235
Nnikic·2 days ago

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

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

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

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

115
Zzhu_zongOP·28 minutes agoLevel 6

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

308
Lli_ming·2 days agoLevel 6

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

32
RraseMod·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.

71
Mmike_xu·2 days agoLevel 6

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

97
Aalice_dev·2 days agoLevel 6

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

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

42
Rrase·2 days ago

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

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

87
Lli_ming·5 hours ago

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

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

25
Ttang_hao·2 hours ago

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

84
NnikicOP·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.

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

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

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

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

64
Hhuang_keMod·2 days ago

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

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

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

47
Oops_wang·2 days ago

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

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

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

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

4
Rran_bo·2 hours ago

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

23
Ttang_hao·2 days ago

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

256
Ddev_zhou·just now

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

3
Hhuang_ke·2 days ago

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

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

1
Lli_ming·3 minutes ago

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

1

This is the post detail page /en/c/monorepo-frontend-qa/post/p11. 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 →