Vue · Remote · Interview notes: how I answered a question about the vue-remote concurrency model

1.5K
VUr/vue-remote·posted by winter·32 minutes agoDiscussion

Interview notes: how I answered a question about the vue-remote concurrency model

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

-- The query that broke: a full scan over 20M rows.
-- A composite index took P99 from 1.8s down to 42ms.
SELECT id, title, created_at
  FROM posts
 WHERE community_id = ?
   AND status = 1
 ORDER BY score DESC
 LIMIT 20;

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.

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-remote itself but our upstream connection reuse — the load test traffic was too clean and hid the long-tail requests.

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

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.

189 comments

189 comments

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

502
Zzhou_yi·2 days ago

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

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

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

124
Rran_boOP·2 days ago

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

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

25
Rran_boOP·just now

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

372
Lli_ming·3 minutes ago

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

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

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

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

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

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

146
Cchen_dev·2 days ago

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

4
Rrase·2 days ago

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

424
Kkernel_panic·2 days ago

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

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

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

196
Kkite·2 days ago

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

327
Ddev_zhou·1 hour agoedited

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

326
Zzhou_yi·2 days ago

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

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

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

303
Wwinter·2 days ago

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

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

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

1
Aalice_dev·2 days agoedited

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

276
Rran_bo·2 hours ago

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

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

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

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

26
Cchen_dev·5 hours ago

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

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

368
Hhuang_ke·2 days ago

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

131
Hhuang_ke·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
Rrase·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.

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

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

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

99
Sslow_query·2 days ago

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

233
Ttang_hao·1 hour ago

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

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

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

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

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

192
Cchen_dev·2 days ago

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

189
Ttang_hao·2 days ago

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

183
Nnikic·yesterday

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

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

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

138
KkiteOPMod·2 days ago

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

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

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

1
Nnikic·1 hour ago

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

124
Zzhou_yi·2 days ago

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

106
Ttang_hao·yesterday

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

91
Lli_ming·2 days ago

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

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

8
Sswoole_lee·2 days ago

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

88
Sswoole_lee·2 hours ago

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

82
Nnikic·2 days ago

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

80
Llinlin·2 days ago

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

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

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

67
Lli_ming·28 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.

54
Aalice_dev·12 minutes agoedited

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

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

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

29
Wwinter·2 days ago

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

35
Ttang_hao·12 minutes ago

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

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

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

46
Ddev_zhouMod·yesterday

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.

43
Llinlin·2 days ago

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

38
Zzhou_yiOP·yesterday

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

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

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

21
Kkernel_panic·yesterday

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

29
Ttang_hao·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
Zzhou_yi·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.

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

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

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

6
Cchen_dev·2 days ago

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

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

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

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

23
Sslow_query·2 days ago

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

5
Ddev_zhou·2 days agoedited

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

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

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

104
Ddev_zhou·3 minutes ago

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

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

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

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

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

103
Ddev_zhou·3 minutes ago

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

264
LlinlinMod·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.

397
Ttang_hao·2 hours ago

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

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

76
Sswoole_lee·2 days ago

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

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

32
Rran_bo·2 days ago

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

470
RraseOP·2 days agoedited

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

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

257
Kkernel_panic·2 days ago

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

491
Mmike_xuOP·2 days ago

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

63
Aalice_dev·2 days ago

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

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

4
Oops_wang·28 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.

27
Zzhu_zong·28 minutes ago

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

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

271
Oops_wang·2 days ago

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

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

45
Kkite·2 hours ago

One counter-example: below vue-remote 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

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.

9
Bbob_chenMod·2 days ago

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

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

403
Kkernel_panic·2 days ago

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

94

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