Vue · Advanced · Cut our vue-pro build from 4 minutes to 40 seconds with these 5 changes

1.6K
VUr/vue-pro·posted by ops_wang·5 minutes agoJobs

Cut our vue-pro build from 4 minutes to 40 seconds with these 5 changes

Short version: vue-pro needs almost no tuning at small and medium scale — the point where it starts to hurt is much further out than most people assume. Full measurements below.

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.

What genuinely surprised me was the tail. The average looked great while P99 jumped by an order of magnitude past some threshold. The cause was not vue-pro itself but our upstream connection reuse — the load test traffic was too clean and hid the long-tail requests.

Bblog.vuejs.orgExternal link · opens in a new tab
418 comments

418 comments

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

516
Mmike_xu·2 days ago

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

455
Wwinter·2 days ago

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

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

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

400
Sswoole_lee·2 days ago

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

399
WwinterOP·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.

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

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

352
Bbob_chen·2 days agoedited

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

341
Bbob_chen·5 hours 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.

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

283
Bbob_chenOP·2 days ago

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

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

306
Aalice_dev·2 days ago

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

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

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

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

258
Mmike_xu·2 days ago

One counter-example: below vue-pro 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
Zzhu_zong·2 days ago

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

256
Sslow_query·2 days ago

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

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

195
Ddev_zhouOP·3 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.

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

207
Kkite·2 days agoedited

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

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

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

205
Kkite·2 days ago

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

200
Llinlin·2 days ago

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

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

200
Cchen_dev·2 days ago

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

194
Aalice_dev·2 days ago

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

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

134
Wwinter·2 days ago

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

146
Kkernel_panic·2 days ago

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

27
Bbob_chen·2 days agoedited

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

175
Aalice_dev·1 hour ago

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

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

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

46
Nnikic·2 days ago

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

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

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

115
Kkernel_panic·1 hour ago

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

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

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

405
Zzhu_zong·2 days ago

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

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

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

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

1
Rran_bo·2 days agoLevel 6

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

306
Aalice_dev·2 days ago

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

2
Mmike_xu·3 minutes ago

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

110
Lli_ming·2 hours agoedited

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

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

31
Sslow_queryMod·yesterday

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

259
Ddev_zhou·28 minutes ago

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

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

45
Mmike_xu·2 days ago

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

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

101
Rrase·2 days ago

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

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

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

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

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

406
Llinlin·12 minutes ago

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

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

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

47
Kkite·2 days ago

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

38
Aalice_dev·1 hour ago

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

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

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

34
Aalice_dev·2 days ago

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

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

19
Sslow_query·2 days ago

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

14
Sswoole_lee·2 days ago

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

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

10
Oops_wang·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
Rrase·2 days ago

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

355
KkiteOP·2 days ago

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

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

3
Aalice_dev·2 days ago

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

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

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

499
Oops_wangMod·3 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.

365
Nnikic·1 hour agoedited

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

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

19
Zzhu_zong·28 minutes ago

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

16
RraseOP·2 days ago

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

2
Sslow_query·2 days ago

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

37
Rran_bo·2 days agoLevel 6

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

248
Ttang_hao·2 days agoLevel 6

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

61
Llinlin·3 minutes 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.

2
Bbob_chen·2 days agoedited

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

151
Oops_wang·2 hours ago

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

35
Oops_wang·2 days ago

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

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

111
Sswoole_leeOP·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.

506
RraseMod·28 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.

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

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

3
Zzhou_yi·yesterdayLevel 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.

29
Cchen_dev·2 days agoLevel 6

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

22
Kkite·2 days ago

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

2
Ddev_zhou·2 days agoeditedLevel 6

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

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

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

175
Hhuang_ke·5 hours agoedited

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

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

22
Zzhou_yi·2 days ago

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

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

27
Bbob_chen·2 days ago

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

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

220
Hhuang_ke·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
Kkite·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.

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

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

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

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.

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

1

This is the post detail page /en/c/vue-pro/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 →