DigitalOcean: Node CPU > 100%


#1

image

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


#2

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?


#3

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


#4

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.


#5

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


#6

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


#7

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.