CPU core issue - Cent OS 6.5 (Latest 64 bit (4.18.16-x86_64-linode118)) running nginx uwsgi django postgres
We recently upgraded our Linode. We have 6 cores with 16GB of memory but now if we go beyond 1 worker process for nginx or 2 processes for uwsgi the server goes into meltdown. Top shows > 100% CPU for uwsgi and typical 5.x waiting processes. We've tried altering the config but it makes no difference. We can't update to Centos 7 due to some python packages in legacy code. Any ideas where to start before we just rebuild on another server.
Thanks
1 Reply
Hey @altcom_support - hopefully you were able to figure this out. I did a little digging around, and it looks like 100% CPU usage related to uwsgi was a known issue for a while. I came across a uwsgi forum on GitHub where the problem was related to uwsgi child processes:
uwsgi child processes race to 100% CPU if master is killed while handling a response
I also found a gem of an article straight from uwsgi that might help with your configuration:
Things to know (best practices and “issues”)
And this Stack Overflow forum post comes from a user running a very similar setup to your own:
Bad Django / uwsgi performance
If you haven't already, I'd also check your system for any internal CPU steal. This can happen if there are background processes running that are in uninterruptible sleep (these are often referred to as D state processes). Here's another Community post that shows you how to identify these processes:
What is CPU steal and how does it affect my Linode?
Additionally, this other Community post reviews other factors that can contribute to high CPU usage:
Why is my Linode suddenly using 100% of its CPU?
I know this is a lot to get through - hopefully some of it helps! If you happened to identify the issue on your server, please share your fix below in case anyone else runs into a similar problem.