I am using Django, wsgi with apache, but the server is really slow when I try to insert data into mysql server. It takes 1 second to insert 200 rows in a table. The strange thing is that only 3% of CPU and memory is used by apache and mysql. I am sure there is some setting wrong, but I cannot find it.
Here is my apache config file, wsgi setting and 'top' command result.
I really appreciate if someone could help me a little bit. Thanks!
My apache config file:
WSGIScriptAlias / "/home/jiechao/EZ_Green/apache/ems_django.wsgi"
ServerName www.ezgreenbuildings.com
WSGIDaemonProcess ezgreenbuildings.com processes=2 maximum-requests=1000 threads=25
WSGIProcessGroup ezgreenbuildings.com
wsgi file:
os.environ['DJANGO_SETTINGS_MODULE'] = 'ems.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
sys.path.append("/home/jiechao/EZ_Green/django")
sys.path.append("/home/jiechao/EZ_Green/django/ems")
top command result:
top - 15:56:02 up 25 days, 19:30, 1 user, load average: 0.74, 0.24, 0.11
Tasks: 112 total, 1 running, 111 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.8%us, 0.7%sy, 0.0%ni, 58.5%id, 40.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4124236k total, 3242020k used, 882216k free, 157960k buffers
Swap: 4192252k total, 440k used, 4191812k free, 2750284k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6487 www-data 20 0 101m 63m 7288 S 1 1.6 0:03.02 apache2
30558 mysql 20 0 313m 44m 7020 S 1 1.1 0:54.98 mysqld
258 root 20 0 0 0 0 D 1 0.0 1:09.21 jbd2/sda1-8
10243 root 20 0 0 0 0 S 0 0.0 0:00.04 kworker/1:1
14410 jiechao 20 0 208m 8268 3296 S 0 0.2 4:39.92 python
1 root 20 0 3504 1876 1276 S 0 0.0 0:01.58 init
2 root 20 0 0 0 0 S 0 0.0 0:00.13 kthreadd
3 root 20 0 0 0 0 S 0 0.0 0:45.39 ksoftirqd/0
5 root 20 0 0 0 0 S 0 0.0 0:00.40 kworker/u:0
6 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/0
7 root RT 0 0 0 0 S 0 0.0 0:03.85 watchdog/0
After Edited.
I added 'WSGIProcessGroup' now, so it should be invoking daemon mode now. I am using Prefork for MPM, but I don't understand how to see the settings of MPM.
For site visits, I think 1000 visits per second is what I would expect.