PM2 start with next.js is too slow
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
Hi I'm running pm2 in cluster mode 8 cores and I'm using for deploy next.js app. But when I start pm2, the memory of each cluster starts at 70mb and when I request work for rendering on the web, the memory starts to grow. (request is pending)
And as soon as the memory reaches 200mb, the request is executed normally. Each request takes more than 10 seconds and takes more than a minute because eight clusters operate. Is this normal case or am I miss something?
How could we reproduce this issue?
It happens every time I start pm2.
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Fri Apr 12 2024 13:22:36 GMT+0900 (Korean Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.3.0
node version : 16.4.0
node path : /root/.nvm/versions/node/v16.4.0/bin/pm2
argv : /root/.nvm/versions/node/v16.4.0/bin/node,/root/.nvm/versions/node/v16.4.0/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : root
uid : 0
gid : 0
uptime : 11min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.3.0
node version : 16.4.0
node path : /root/.nvm/versions/node/v16.4.0/bin/pm2
argv : /root/.nvm/versions/node/v16.4.0/bin/node,/root/.nvm/versions/node/v16.4.0/bin/pm2,report
argv0 : node
user : root
uid : 0
gid : 0
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
cpus nb : 4
freemem : 362532864
totalmem : 4109983744
home : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name │ mode │ ↺ │ status │ cpu │ memory │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0 │ work-app │ cluster │ 1 │ online │ 0.7% │ 160.8mb │
│ 1 │ work-app │ cluster │ 1 │ online │ 0% │ 165.6mb │
│ 2 │ work-app │ cluster │ 1 │ online │ 0.7% │ 164.5mb │
│ 3 │ work-app │ cluster │ 1 │ online │ 0.4% │ 161.3mb │
│ 4 │ work-app │ cluster │ 1 │ online │ 0.4% │ 163.7mb │
│ 5 │ work-app │ cluster │ 1 │ online │ 0.4% │ 158.8mb │
│ 6 │ work-app │ cluster │ 1 │ online │ 0.4% │ 164.7mb │
│ 7 │ work-app │ cluster │ 1 │ online │ 0.4% │ 164.5mb │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
[PM2][WARN] Current process list is not synchronized with saved list. Type 'pm2 save' to synchronize.
===============================================================================
--- Daemon logs --------------------------------------------
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report identifies PM2 5.3.0, Node.js 16.4.0, cluster mode, and a Next.js deployment, but names no source file, test, or entry point. Start by reproducing the delayed requests with the reported cluster configuration and compare behavior with fewer workers; the issue does not define a confirmed cause or a clear completion condition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, node.js
- Domain
- devops, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100