[web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread VP
I also test uwsgi serving a Bottle app.  I run from the command line, 
uwsgi, the bottle app with 8 processes.


This works as I expect.   Requests are served by unbusy processes while 
long-running requests are still being run.


So something about the web2py configuration that doesn't tell uwsgi to run 
with multiple processes.

Does anyone have any clue?

Thanks.

-- 





[web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread Alan Etkin
El martes, 8 de enero de 2013 20:58:10 UTC-3, VP escribió:

 I also test uwsgi serving a Bottle app.  I run from the command line, 
 uwsgi, the bottle app with 8 processes.


Is that the file created by the script?. uwsgi can take options in 
different ways. Make sure it is actually reading the options from there. 
For example, the CentOS script creates a .conf file

-- 





[web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread VP
Alan,
No.  From the command line, I told uwsgi to run with 8 processes (for the 
Bottle app).  Here's the command:

uwsgi --http 127.0.0.1:8080 -p 8 --plugins python --module=app:application



On Tuesday, January 8, 2013 6:09:07 PM UTC-6, Alan Etkin wrote:

 El martes, 8 de enero de 2013 20:58:10 UTC-3, VP escribió:

 I also test uwsgi serving a Bottle app.  I run from the command line, 
 uwsgi, the bottle app with 8 processes.


 Is that the file created by the script?. uwsgi can take options in 
 different ways. Make sure it is actually reading the options from there. 
 For example, the CentOS script creates a .conf file



-- 





[web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread VP
Those who are running nginx, uwsgi, web2py, can you do a quick check to see 
if uwsgi reads your web2py config file properly?

The default config has 4 processes.  If you do a top -u www-data, you 
should see 5 uwsgi processes (4 + 1 master).

If you see a different number (may be 3?), then there might be a problem.

Thanks.

-- 





Re: [web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread Bruno Rocha
I have a single server, ubuntu 12.04 running 3 web2py instances + 2 php
wordpress websites

Php runs with fcgi - web2py runs with uwsgi, because of that I have 12
nginx workers running

I am not an expert on this, but this solution is working well for me.


That is what I have in top


*TOP*
top - 22:54:55 up 78 days,  4:24,  1 user,  load average: 0.05, 0.13, 0.13
Tasks: 111 total,   1 running, 110 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.1%us,  0.2%sy,  0.0%ni, 98.2%id,  1.5%wa,  0.0%hi,  0.1%si,
0.0%st
Mem:   1012860k total,   934292k used,78568k free,27148k buffers
Swap:   524284k total,   343908k used,   180376k free,   258680k cached

  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+
COMMAND
 1123 www-data  20   0  396m  41m  14m S0  4.2   7:40.82
php5-fpm
 3738 www-data  20   0  160m 1512 1472 S0  0.1   5:00.87
uwsgi-core
 3901 www-data  20   0  160m 1512 1472 S0  0.1   5:04.47
uwsgi-core
 4730 www-data  20   0  397m  43m  15m S0  4.4   9:45.87
php5-fpm
 4731 www-data  20   0  397m  42m  15m S0  4.3   9:41.48
php5-fpm
 4732 www-data  20   0  392m  37m  14m S0  3.8   9:32.35
php5-fpm
 4734 www-data  20   0  393m  38m  15m S0  3.9   9:58.31
php5-fpm
 5113 www-data  20   0  208m  36m 3824 S0  3.7   0:56.18
uwsgi
 8993 www-data  20   0  240m  94m 4504 S0  9.5   0:20.76
uwsgi
 9409 www-data  20   0  217m 2188 2184 S0  0.2   1:34.40
uwsgi-core
 9410 www-data  20   0  217m 4388 2180 S0  0.4   0:51.60
uwsgi-core
 9457 www-data  20   0  214m  65m 4840 S0  6.7   0:08.62
uwsgi
15463 www-data  20   0 79460 3356 1664 S0  0.3   5:56.76
nginx
15464 www-data  20   0 79108 3476 1712 S0  0.3   5:56.79
nginx
15465 www-data  20   0 79632 3480 1656 S0  0.3   5:59.49
nginx
15466 www-data  20   0 79468 3392 1652 S0  0.3   5:54.69
nginx
15467 www-data  20   0 79184 3244 1660 S0  0.3   5:49.36
nginx
15468 www-data  20   0 79460 3380 1668 S0  0.3   5:39.78
nginx
15469 www-data  20   0 79604 3860 1672 S0  0.4   5:46.62
nginx
15470 www-data  20   0 79488 3368 1680 S0  0.3   5:55.42
nginx
15471 www-data  20   0 79604 3280 1656 S0  0.3   5:52.24
nginx
15472 www-data  20   0 79444 3468 1688 S0  0.3   5:59.96
nginx
15473 www-data  20   0 79440 3452 1684 S0  0.3   5:54.13
nginx
15474 www-data  20   0 79476 3516 1692 S0  0.3   5:49.28
nginx
16040 www-data  20   0  193m  47m 3884 S0  4.8   2:49.74
uwsgi
22482 www-data  20   0  153m 2384 2144 S0  0.2   2:41.56
uwsgi
22651 www-data  20   0  160m 4864 2208 S0  0.5   2:42.54
uwsgi
22818 www-data  20   0  160m 5532 2220 S0  0.5   3:01.67
uwsgi
28847 www-data  20   0  192m  46m 3588 S0  4.7   2:18.97
uwsgi
29885 www-data  20   0  208m  37m 4052 S0  3.8   0:34.50
uwsgi
29914 www-data  20   0  222m 2192 2188 S0  0.2   0:11.24
uwsgi-core
30403 www-data  20   0  205m 2208 2176 S0  0.2   0:05.77
uwsgi-core


*uwsgitop*

uwsgi-1.0.3-debian - Tue Jan  8 23:01:58 2013 - req: 1110940 - lq: 0 - tx:
22786619414
node: li284-252 - cwd: /home/www-data/web2py - uid: 33 - gid: 33 -
masterpid: 22818
 WID%   PID REQ EXC SIG STATUS  AVG RSS
VSZ TX  RunT
 1  71.03   10199   789111  0   0   idle162ms   76M
222M15494M  3912m
 2  28.97   10171   321829  0   0   idle246ms   60M
205M6236M   1776m



*UWSGI FILE* ( Ihave the same file for other 2 apps, but other apps have no
master tag )

uwsgi
pluginpython/plugin
socket/run/uwsgi/app/web2py/web2py.socket/socket
pythonpath/home/www-data/web2py//pythonpath
app mountpoint=/
scriptwsgihandler/script
/app
master/
processes4/processes
harakiri60/harakiri
reload-mercy8/reload-mercy
cpu-affinity1/cpu-affinity
stats/tmp/stats.socket/stats
max-requests2000/max-requests
limit-as512/limit-as
reload-on-as256/reload-on-as
reload-on-rss192/reload-on-rss
no-orphans/
vacuum/
/uwsgi


*NGINX FILE*

server {
server_name x.com.br;

rewrite ^/(.*) http://www.xx.com.br/$1 permanent;
   }


server {
client_max_body_size 10M;
listen  80;
server_name wwwcom.br;


if ( $http_referer ~*
(babes|forsale|girl|jewelry|love|nudit|poker|porn|sex|teen) )
{
 # return 404;
 return 403;
}

if ($request_method !~ ^(GET|HEAD|POST)$ ) {
 return 444;
}

location ~ \.(aspx|php|jsp|asp|cgi)$ {
   return 410;
}

if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
return 403;
}

if ($http_user_agent ~*
msnbot|scrapbot|WebCopier|AhrefsBot|Baidu|Yandex|baiduspider|yandexspider )
{
return 403;
}

location ~* /(\w+)/static/ {
   root /home/www-data/web2py/applications/;
}

   location ~ ^/download/(.*)$ {
   alias 

Re: [web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread VP
Thanks Bruno.

Okay, I figured it out.  I'm not sure if I used an out-of-date 
web2py/uwsgi/ngninx install script, but that script does not mention 
another file /usr/share/uwsgi/conf/default.ini 

This file sets the number of workers to 2 and it overwrites the web2py 
configuration file /etc/uwsgi/apps-available/web2py.xml 


-- 





Re: [web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread Bruno Rocha
and youi delete or comment that file?

-- 





Re: [web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread VP
yeah.  I commented off the worker=2 setting in that file.  Consequently, 
the number of workers was exactly what the web2py configure file says.



On Tuesday, January 8, 2013 7:36:01 PM UTC-6, rochacbruno wrote:

 and youi delete or comment that file?


-- 





Re: [web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread Bruno Rocha
Ok, but just read this

# User-made changes in this file will be silently lost, as it is silently
# rewrited with upgrade of uwsgi package.
#
# If you want to change default options of uWSGI daemon, then:
# * copy this file somewhere
# * add/remove/change options in copied file
# * edit /etc/default/uwsgi and change location of inherited configuration
#   file to path to copied file

--