PWA · Interviews · This pwa-interview bug hid for three years before anyone reported it

1.1K
PWr/pwa-interview·posted by tang_hao·3 days agoTutorialPinnedLocked

This pwa-interview bug hid for three years before anyone reported it

Most pwa-interview articles stop at "how to use it" and never cover "when not to use it". This is an attempt at the second half.

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.

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

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

367 comments

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

519
Rran_boMod·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.

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

511
Cchen_devOP·2 days ago

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

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

505
Wwinter·3 minutes ago

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

20
Rran_bo·2 days ago

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

497
Bbob_chen·12 minutes ago

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

13
Zzhu_zong·2 days agoedited

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

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

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

500
Kkernel_panic·2 days ago

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

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

489
Bbob_chen·2 days ago

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

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

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

2
Oops_wangMod·2 days agoedited

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

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

445
Bbob_chen·yesterday

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.

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

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

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

313
Zzhu_zong·just now

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

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

161
Mmike_xuOP·2 days ago

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

457
Cchen_dev·5 hours ago

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

146
Hhuang_ke·2 hours ago

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

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

102
Rran_bo·yesterday

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

78
Mmike_xu·2 days ago

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

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

217
Ttang_hao·5 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.

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

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

202
Oops_wangMod·yesterday

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

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

162
Rran_boOP·2 days agoLevel 6

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

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

56
Hhuang_ke·2 days ago

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

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

422
Mmike_xu·2 days agoedited

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

190
Rran_bo·2 days ago

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

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

17
Cchen_devOP·1 hour ago

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

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

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

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

110
Ttang_hao·2 days agoedited

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

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

213
Ddev_zhou·2 days ago

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

211
Zzhu_zong·yesterdayedited

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

159
Hhuang_ke·12 minutes ago

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

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

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

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

194
Aalice_devOP·5 hours 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.

23
Ddev_zhou·5 hours 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.

183
Oops_wangOP·2 days ago

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

2
Kkite·2 days agoedited

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

54
Kkite·2 days ago

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

77
Cchen_dev·2 days ago

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

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

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

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

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

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

85
Kkite·just now

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

205
Mmike_xu·2 days agoLevel 6

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

228
Wwinter·2 days ago

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

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

2
Lli_mingMod·2 days agoedited

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

344
Ttang_hao·2 days ago

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

105
Mmike_xuOP·2 days ago

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

19
Aalice_dev·2 days ago

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

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

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

211
Ddev_zhouOP·2 days ago

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

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

132
Ddev_zhou·2 days ago

I just read the pwa-interview 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

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.

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

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

13
Mmike_xu·2 days ago

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

73
Sswoole_lee·yesterday

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.

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

183
Cchen_dev·2 days ago

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

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

156
Ttang_hao·2 days ago

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

15
KkiteOP·2 days ago

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

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

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

69
Hhuang_keOPMod·2 days ago

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

4
Lli_ming·12 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.

63
Hhuang_keOP·3 minutes 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

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

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

441
Aalice_dev·yesterday

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.

336
Sslow_query·5 hours ago

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

364
Hhuang_ke·28 minutes ago

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

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

36
Cchen_dev·2 days ago

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

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

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

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

32
Ttang_hao·2 days ago

One counter-example: below pwa-interview 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
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.

14
Llinlin·2 days agoedited

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

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

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

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

9
Sswoole_lee·2 days ago

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

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

3
Kkite·2 days agoedited

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

157
Zzhu_zong·28 minutes ago

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

3
Llinlin·2 days ago

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

3
Ddev_zhou·2 days ago

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

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

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

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

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

This is the post detail page /en/c/pwa-interview/post/p0. 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 →