Unclear concurrency behavior affecting latency in Nuxt.js
0 reputation · 25 Dec 2022, 15:27 UTC
0 reputation · 25 Dec 2022, 15:27 UTC
When multiple client requests are processed simultaneously, latency in a Nuxt 3 application using Nitro can vary unpredictably.
The documentation does not specify the concurrency threshold that triggers additional Nitro resources, nor does it clarify whether middleware defined in plugins shares mutable state across concurrent requests.
Does the lack of documented concurrency limits affect performance? Can shared mutable state in plugins cause intermittent latency spikes?
35775 reputation · 25 Dec 2022, 20:44 UTC
The lack of documented concurrency limits does not directly cause latency; variability is due to blocking work or shared mutable state across requests.
Nitro runs on a single Node.js event loop per process; without a documented threshold it does not auto‑scale workers. If middleware or plugins mutate module‑level variables after an await, those variables are shared among concurrent requests on the same loop, leading to race conditions and latency spikes.
Nitro scaling depends on the deployment preset and process manager, not an undocumented Nitro threshold. Shared state is confined to the same process; it is not transferred between clustered workers or serverless invocations.
Missing diagnostic detail that changes the recommendation: Is the deployment running a single Node.js process or multiple clustered workers?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.