Answer the question
In order to leave comments, you need to log in
How to restart the server if the cpu usage has reached 100%?
I have a server started with pm2 in cluster mode. When there are too many requests to the server, it freezes and stops responding. Moreover, it is also not possible to connect to it via ssh. It remains only to restart it manually. Is it possible to somehow catch the moment when the load on the server becomes limiting and restart it at that moment?
Answer the question
In order to leave comments, you need to log in
Catch cpu usage
Here they showed how to do it
Well, then just if(cpuUsage > 85) then killAll()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question