I recently launched a web app that gets constantly pegged at 100% CPU. My server is a 512 MB Linode with nginx sitting in front of Apache (MPM Worker) serving a Django app. This app is unusual in that it has to do heavy database processing < 5% of the time (~2-5k queries/request). I only have a small number of users currently (50 in a day, ~5-10 at any given time). Now I understand doing several thousand queries is over the top and I'm looking into optimizing it, but I don't understand why the Apache processes go to 100% and stay there even though no one is currently visiting the heavy load page.
Here is part of my Apache config:
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
Here's my the top few lines from 'top':
10257 www-data 20 0 370m 143m 4052 S 100 29.0 16:19.47 apache2
1 root 20 0 2728 224 24 S 0 0.0 0:01.34 init
2 root 20 0 0 0 0 S 0 0.0 0:00.00 kthreadd
Any help would be much appreciated!