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"
conf"
- Apache configure related mod_wsgi:app@application:~$ sudo cat /etc/apache2/sites-available/ussd-pull.conf
<VirtualHost *:8080>
# ---- Configure VirtualHost Defaults ----
ServerAdmin loca...@abc.com
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
app@application:~$ sudo cat ~/public_html/wsgi/ussd_pull.wsgi
import sys
sys.path.insert(0,'/home/app/public_html/apps/ussd_pull')
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.
<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.
--
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 modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
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 modwsgi+u...@googlegroups.com.
app@application:~$ time curl "http://10.8.39.26:8080/ussd/main" > /dev/null 2&>1
real 0m0.025s
user 0m0.000s
sys 0m0.016s
app@application:~$ time curl "http://10.8.39.26:8080/ussd/main" > /dev/null 2&>1
real 0m0.251s
user 0m0.008s
sys 0m0.012s
mod_wsgi.process_group = 'ussd_pull'
mod_wsgi.application_group = ''
mod_wsgi.application_group = ''
Opps, I apology for my terrible mistake, because my error log actually is:
Embedded mode of mod_wsgi disabled by runtime configuration: /home/app/public_html/wsgi/ussd_pull.wsgi
I set already:
WSGIDaemonProcess ussd_pull processes=3 threads=5Now, if i have "WSGIRestrictEmbedded On" of top of apache config file, i always get above error message and web responds code 500.If i remove "WSGIRestrictEmbedded On", the web app will back to normal but apply mode check i got the result:
mod_wsgi.application_group = ''
On 10/06/2014, at 5:15 PM, Minh Tuan <hands...@gmail.com> wrote:Opps, I apology for my terrible mistake, because my error log actually is:
Embedded mode of mod_wsgi disabled by runtime configuration: /home/app/public_html/wsgi/ussd_pull.wsgi
I set already:
WSGIDaemonProcess ussd_pull processes=3 threads=5Now, if i have "WSGIRestrictEmbedded On" of top of apache config file, i always get above error message and web responds code 500.If i remove "WSGIRestrictEmbedded On", the web app will back to normal but apply mode check i got the result:
mod_wsgi.application_group = ''You ran the test for which sub interpreter, it that for embedded mode vs daemon mode if you are printing out mod_wsgi.application_group.
mod_wsgi.process_group = ''My apache configure now is:
#WSGIRestrictEmbedded On -> if uncommend this, i get the error
I want to correct:
WSGIDaemonProcess ussd_pull processed=3 threads=5
mod_wsgi.process_group = 'ussd_pull'
I'm going to follow the step 5 and 6 as your above guide line. Many thanks. You are the best, really.
Regard,
Tuan.
Agreeing with Graham that you should balance connections across servers. I suggest that you consider placing nginx in front and proxying to 2-3 back end servers.
As for modwsgi performance under real world conditions, we recently had a case where Google Chrome was viewing a video by requesting 1 byte per request. 20,000 requests in less than an hour. Each request needed authenticated (redis/postgresql) and access checks performed (postgresql) before retuning x-accel-redirect to nginx.
My point is that while 20,000 per hour is no huge number, it effortlessly handled it with fairly standard apache prefork / modwsgi 6 processes 15 threads config.
I find that letting nginx handle the front end, I can get a lot more done with a lot fewer python threads, plus you are setup to terminate ssl and load balance for free too.
We allocate a separate port in apache for each app to keep things clear.
Listen 127.0.0.1:15671
NameVirtualHost 127.0.0.1:15671
<VirtualHost 127.0.0.1:15671>
....
Then in nginx, we use in the server container the following (approx) config:
Location static-stuff
root /path/to/app/static
Location /
proxy_pass 127.0.0.1:15671
Strongly suggest you do that and re-test.
Jason
One thing I would very much suggest is that you keep an eye out on this mailing list or my twitter account for mention of some blog posts about this whole subject.I have been doing various tests this weekend using my new magic for capturing and charting metrics out of mod_wsgi to illustrate the sorts of improvements one can get from tuning but also in using a front end.As an example, from a pretty standard configuration of Apache/mod_wsgi I have managed to go from about 300 requests/sec up to more than 1200 requests/sec. The final arrangement would even handle you specific problem case of slow mobile clients.
I can say we are eager to see these upcoming blog posts as having literally built a business on modwsgi and having fast growing apps - very interested.
Thanks!
...
Visit this group at https://groups.google.com/group/modwsgi.