medusa icon indicating copy to clipboard operation
medusa copied to clipboard

Medusa-server uses all available cpu

Open MitchelKerckhaert opened this issue 2 years ago • 1 comments

Hi, I am working on my first project using medusajs and it was going allright so far. Got to the point where I wanted to deploy it on a server so others could take a look. But when I started up the backend, the cpu usage instantly went to 100% percent and never came back down.

I am deploying to Linode (smalles sized shared cpu plan. 1 Core 2.2Ghz) and am running postgres and redis on the same vps. I have tried running the backend with and without using docker, but that didn't make a difference. I have a screenshot below from running the top command. The top node process is medusajs. Both the docker-proxy and redis-server massively increased in cpu usage as well after launching the backend, even without any incoming requests. image

Up till know I have been running everything on my laptop without any issues. It has a bit more power, but doesn't even use 1% of the available cpu when running idle. If anyone could let me know if this is a bug, or if I maybe haven't understood some inner workings of the system that is causing this that would be great! Let me know if I can provide anymore info.

MitchelKerckhaert avatar May 24 '22 11:05 MitchelKerckhaert

@MitchelKerckhaert

very hard to imagine what could be the issue . From my experience in node in general where i had any kind of crazy issue ,cpu, project don't even want to launch and crazy stuff.

I would say most of the time was my node Version , or some tools/plugin/dependancie version that didn't play along. So just check that that node version is correct (should be 14 or 16)

I can see you have PM2 maybe start to check PM2 Logs

$HOME/.pm2/logs/XXX-err.log should something like that or google pm2 logs you have by default (PM2, + node + docker proxy + redis-server). Maybe you can try to have something ultra very basic first

node + medusa(just api) + db -> Check if ok , you can try to CURL-> localhost see output check cpu/memory usage then add docker-proxy->check if ok then add redis -> check if ok then add admin -> check if ok

AlexDigital974 avatar Jun 22 '22 09:06 AlexDigital974

I believe this is fixed. I don't have all my resources available consumed. feel free to reopen if needed

adrien2p avatar Dec 06 '23 09:12 adrien2p