5

I wanted to run my django application using apache and uWSGI. So I installed apache which use worker_module. When I finally run my app and tested its performance using httperf I noticed that system is able to serve only one user at the same time. The strange thing is that when I run uWSGI using the same command as below with nginx I can serve 97 concurrent users. Is it possible that apache works so slow?

My apache configuration looks like (most important elements - the extant settings are default):

<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxClients           63
    MaxRequestsPerChild   0
</IfModule>
...
<Location />
    SetHandler uwsgi-handler
    uWSGISocket 127.0.0.1:8000
</Location>

I run uwsgi using:

uwsgi --socket :8000 --chmod-socket --module wsgi_app --pythonpath /home/user/directory/uwsgi -p 6
0

1 Answer 1

1

I recommend that you put Apache behind Nginx. For example:

  • bind Apache to 127.0.0.1:81
  • bind nginx to 0.0.0.0:80
  • make nginx proxy domains that Apache should serve

It's not a direct answer to your question but that's IMHO the best solution:

  • best performance
  • best protection for Apache
  • allows to migrate Apache websites to Nginx step by step (uWSGI supports PHP now ...), again for best performance and security
Sign up to request clarification or add additional context in comments.

2 Comments

Very useful answer, but I just wanted to check which http server is better for serving django apps. I am confused because I thought apache would be at least half good as nginx.
For apache, mod_wsgi is older and thus more mature than uwsgi for apache. However, you may want to ask on uwsgi irc channel or mailing list to reach the community for answers about uwsgi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.