I'm developing a web application, and have a trouble that performance of Django doesn't improve when I increase number of CPU cores.
(actually 1 core does the highest performance and 2,4,8 cores don't differ much in their performance)
What my application does is to simply load static files(HTML, CSS, JS) and some data from database.
I use Apache as a web server and mod_wsgi.
Is this Django's normal behavior?
If so how could I improve the performance with multi cores?
(I want to increase number of cores because CPU usage reaches about 90% with just 1 core)
▼ab -n 200 -c 200 for 1CPU core and 1GB memory
▼ab -n 200 -c 200 for 2CPU cores and 1GB memory
▼vmstat 1 for 1CPU core and 1GB memory
▼vmstat 1 for 2CPU cores and 1GB memory
I found that I just had to make some changes to Apache config file. I changed
WSGIDaemonProcess localhost
to
WSGIDaemonProcess localhost processes=2 threads=25
then response time decreased from 7 seconds to 2 seconds.
after that, I experimented with other number of CPU cores, and when I set the same number of processes as number of CPU cores, performance got better.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With