DigitalOcean: Node CPU > 100%



In the past and now I can’t find the best solution???


Is this a problem of having only few users but high CPU usage? Or do you have a lot of users and you need to scale horizontally?


thanks for your reply.
the problem when users (5-10) view the application report at the same time.
could you help me?


You need to profile your app and figure out the part that is taking a lot of time to execute. If it is a long running process, I recommend that you put it in a background job and then notify the user when the report is ready.


Did you try upgrading the instance to a bigger droplet? Last time I tried the 512 MB ram did NOT work for me. I got lucky with 1 GB Ram


@rjdavid, could you example?
Now I tried upgrade to 8 G of Ram!!!
It still has this problem.


you need to adjust this value to make use of the new space. If your process is memory intensive then it might be spending too much time garbage collecting.

TOOL_NODE_FLAGS=--max-old-space-size=2048 node ...

adjust the parameter for your memory. note it should be below the physical memory size of the droplet to account for other memory usage.

Garbage collection high %