Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.55k stars 2.63k forks source link

PM2 start with next.js is too slow #5800

Open leesb971204 opened 7 months ago

leesb971204 commented 7 months ago

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 --------------------------------------------
tyghaykal commented 3 months ago

Is it solved? i meet the same problem right now

leesb971204 commented 3 months ago

Is it solved? i meet the same problem right now

I just use curl localhost 8 times in server to render my next app immediately on web :(

flyerH commented 1 month ago

Same problem and I use an another ssr framework