What sort of throughput does your site get and how long is the average response 
time?

A setting of threads=200 for daemon mode is ill advised and although the way 
mod_wsgi daemon works it should largely mitigate the problems that are caused 
by such an over the top value, Python's less than stellar threading model may 
cause issues.

Also, have you validated that Apache is matching incoming requests properly and 
routing them into the daemon process? You can check where the request is being 
handled by doing the tests:

  
http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Embedded_Or_Daemon_Mode
  
http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Sub_Interpreter_Being_Used

To be safe and ensure things aren't executing in embedded mode, I would suggest 
adding WSGIRestrictEmbedded directive to disable embedded mode altogether.

  http://blog.dscpl.com.au/2009/11/save-on-memory-with-modwsgi-30.html
  http://blog.dscpl.com.au/2012/10/why-are-you-using-embedded-mode-of.html

BTW, mod_wsgi version 3.4 has a security issue and you should try and upgrade, 
unless of course this is the patched version of the Debian package for mod_wsgi.

  http://blog.dscpl.com.au/2014/05/security-release-for-modwsgi-version-35.html

Graham

On 02/06/2014, at 9:04 PM, Minh Tuan <[email protected]> wrote:

> Dear Graham,
> - Apache prefork MPM settings: I have not touched it yet, thus it is default:
> - mod_wsgi version is 3.4, refer to your guide line here
> - Apache version:
> app@application:~/public_html/logs$ sudo apachectl -V
> 
> Server version: Apache/2.4.9 (Debian)
> 
> Server built:   Mar 29 2014 22:29:22
> 
> Server's Module Magic Number: 20120211:31
> 
> Server loaded:  APR 1.5.1, APR-UTIL 1.5.3
> 
> Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3
> 
> Architecture:   64-bit
> 
> Server MPM:     prefork
> 
>   threaded:     no
> 
>     forked:     yes (variable process count)
> 
> Server compiled with....
> 
>  -D APR_HAS_SENDFILE
> 
>  -D APR_HAS_MMAP
> 
>  -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
> 
>  -D APR_USE_SYSVSEM_SERIALIZE
> 
>  -D APR_USE_PTHREAD_SERIALIZE
> 
>  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
> 
>  -D APR_HAS_OTHER_CHILD
> 
>  -D AP_HAVE_RELIABLE_PIPED_LOGS
> 
>  -D DYNAMIC_MODULE_LIMIT=256
> 
>  -D HTTPD_ROOT="/etc/apache2"
> 
>  -D SUEXEC_BIN="/usr/lib/apache2/suexec"
> 
>  -D DEFAULT_PIDLOG="/var/run/apache2.pid"
> 
>  -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
> 
>  -D DEFAULT_ERRORLOG="logs/error_log"
> 
>  -D AP_TYPES_CONFIG_FILE="mime.types"
> 
>  -D SERVER_CONFIG_FILE="apache2.
> conf"
> 
> - Apache configure related mod_wsgi:
> app@application:~$ sudo cat /etc/apache2/sites-available/ussd-pull.conf
> 
> 
> 
> <VirtualHost *:8080>
> 
>  
>     # ---- Configure VirtualHost Defaults ----
> 
>  
>     ServerAdmin [email protected]
> 
>  
>         DocumentRoot /home/app/public_html/http
> 
>  
>         <Directory />
> 
>                 Options FollowSymLinks
> 
>                 AllowOverride None
> 
>                 Require all granted
> 
>         </Directory>
> 
>  
>         <Directory /home/app/public_html/http/>
> 
>                 Options Indexes FollowSymLinks MultiViews
> 
>                 AllowOverride None
> 
>                 Require all granted
> 
>         </Directory>
> 
>  
>     # ---- Configure WSGI Listener(s) ----
> 
>  
>         WSGIDaemonProcess ussd_pull user=www-data group=www-data threads=200
> 
>         WSGIScriptAlias /ussd /home/app/public_html/wsgi/ussd_pull.wsgi
> 
>  
>         <Directory /home/app/public_html/wsgi>
> 
>                 WSGIProcessGroup ussd_pull
> 
>                 WSGIApplicationGroup %{GLOBAL}
> 
>                 Require all granted
> 
>         </Directory>
> 
>  
>     # ---- Configure Logging ----
> 
>  
>     ErrorLog /home/app/public_html/logs/error.log
> 
>     LogLevel warn
> 
>     CustomLog /home/app/public_html/logs/access.log combined
> 
> </VirtualHost>
> 
> - wsgi file:
> app@application:~$ sudo cat ~/public_html/wsgi/ussd_pull.wsgi
> 
> 
> 
> import sys
> 
> sys.path.insert(0,'/home/app/public_html/apps/ussd_pull')
> 
> from ussd_pull import app as application
> 
> - Python version:
> app@application:~$ python
> 
> 
> 
> Python 2.7.6 (default, Mar 22 2014, 15:40:47)
> 
> [GCC 4.8.2] on linux2
> 
> Type "help", "copyright", "credits" or "license" for more information.
> 
> >>> 
> 
> So shame that i dont know where MPM parameters are of Apache 2.4 so it should 
> default like 2.2 version:
> <IfModule mpm_prefork_module>
>     StartServers        5
>     MinSpareServers     5
>     MaxSpareServers     10
>     MaxClients          150
>     MaxRequestsPerChild 0
> </IfModule>
> and i've not installed the packet apache2-dev yet as your suggestions.
> 
> Many thanks.
> Tuan.
> 
> 
> 
> On Mon, Jun 2, 2014 at 5:27 PM, Graham Dumpleton <[email protected]> 
> wrote:
> 
> On 02/06/2014, at 8:18 PM, Ice Prince <[email protected]> wrote:
> 
> > Hi list,
> > Believe you are doing well.
> > I'm configuring a web application which using Apache + mod_wsgi + Flask and 
> > i have performance issue now.
> > My application is very tiny, it just responds some short text only.
> > My apache MPM is prefork as default, wsgi is configured to run in daemon 
> > mode.
> > Tested by ab -n 10000 -c 200 http:/test/test  i got a very good result as 
> > Request per second: 1500#/sec, time per request just 0.6ms.
> > But i make an actual testing which from test server, i fetch the url 
> > http:/test/test with speed is 100 request/second only, my web service 
> > become laggy, the response time reach to 3 seconds as my manual monitoring.
> > After calculation i found the actual requests i can handle only 40 
> > requests/second.
> > I don't know how to do next, please give some some light. Many thanks.
> 
> I would really need to see the Apache configuration related to mod_wsgi as 
> well as the Apache prefork MPM settings you have configured.
> 
> So start by giving what you think covers that and I will ask for more if you 
> haven't supplied everything.
> 
> Also confirm what version of mod_wsgi, Apache and Python you are using.
> 
> Graham
> 
> --
> You received this message because you are subscribed to a topic in the Google 
> Groups "modwsgi" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/modwsgi/rufSwTh6PLI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
>   <====((=o-( ',_,' )-o=))=====>
> 
> Bản chất tốt nhưng cuộc đời xô đẩy!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to