1. You should use -C 5 or even more, like -C 10
2. I think you should use multiplexed=True
3. If you use some different ports to run web.py, your nginx will a
proxy server then. And I do think this will make your app even faster.

BTW, I don't write any wsgi.py for webpy, just app.py for my
application. Is this wsgi.py part of web.py or you wrote it?

On 1月30日, 下午4时22分, skp_999 <[email protected]> wrote:
> I run my webpy apps with the following configuration (based on infos
> found athttp://webpy.org/cookbook/fastcgi-nginx):
>
> relevant part of my nginx.conf (nginx runs with 1 master and 1
> worker):
> -----
> location / {
>     include fastcgi_params;
>     fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
>     fastcgi_param PATH_INFO $fastcgi_script_name;
>     fastcgi_pass 127.0.0.1:8100;}
>
> -----
>
> how I spawn my fcgi processes:
> -----
> spawn-fcgi -C 5 -f /path/to/myapp.py -a 127.0.0.1 -p 8100 -P /path/to/
> myapppid.pid
> -----
>
> myapp.py
> -----
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> import web
>
> urls = ("/.*", "hello")
> app = web.application(urls, globals())
>
> class hello:
>     def GET(self):
>         return 'Hello, world!'
>
> if __name__ == "__main__":
>         web.wsgi.runwsgi = lambda func, addr = None: web.wsgi.runfcgi(func,
> addr)
>         app.run()
> ------
>
> wsgi.py of Webpy
> -----
> def runfcgi(func, addr=('localhost', 8000)):
>     """Runs a WSGI function as a FastCGI server."""
>     import flup.server.fcgi as flups
>     return flups.WSGIServer(func, multiplexed=True,
> bindAddress=addr).run()
> ----
>
> Now my questions:
>
> 1) Should I spawn 1 or more myapp.py processes  (with '-C 5' I have 5
> workers) ?
>
> 2) Should I run flups with multiplexed=True or False (and/or other
> options) ?
>
> 3) Do I need a different fcgi port for each of my webpy apps (I'm
> talking about port 8000 in wsgi.py) ?
>
> BTW Right now my env variables report :
>     wsgi.multiprocess: False
>     wsgi.multithread: True
> but with 'top' I see also my 5 processes
>
> tnx

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to