I'm pleased to announce gevent-fastcgi library. It allows you to deploy your WSGI application using FastCGI protocol. It is still in Beta stage and I'll greatly appreciate bug reports and ideas on how it could be improved.
What makes it special? Well, gevent means greenlet co-routines are used in place of usual threads (no GIL brakes). FastCGI means you can use UNIX-sockets instead of TCP for faster communication between Web- server and WSGI application. There is forgotten treasure - FastCGI connection multiplexing - when single connection between Web-server and application is used for multiple simultaneous requests. All above combined with "native" usage of gevent library (no monkey-patching) is what I believe makes it unique. Of course, like anything else, it is not a solution to any problem. Your application must be "green" in order to work well with gevent- fastcgi. For instance your application should use DBAPI that is coroutine-friendly (see psycopg2.extensions.set_wait_callback). And despite the fact it's been used for several month on low-load production server it most likely has its bugs. Lets see how you can deploy your Pylons/Pyramid application using gevent-fastgi: First, install gevent-fastcgi package: $ pip install gevent-fastcgi or $ easy_install gevent-fastcgi or checkout from git repository at https://github.com/momyc/gevent-fastcgi.git Once it's installed you have two more options to deploy your application: If you use PasteDeploy or pserve method: [server:main] use = gevent_fastcgi#fastcgi host = 127.0.0.1 port = 5432 # socket can be used instead of host/port # socket = /path/to/socket # set maximum simultaneous connections allowed (don't forget to set your OS limits accordingly) # max_conns = 32768 # try to recv data in big chunks # set it to expected request body size + 8 bytes of FastCGI header # affects performance of requests that have content # buffer_size = 4096 Instantiate WSGIServer and call its serve_forever method. The following is modified version of simple Pyramid application as per official Pyramid docs: from gevent_fastcgi.server import WSGIServer from pyramid.config import Configurator from pyramid.response import Response def hello_world(request): return Response('Hello %(name)s!' % request.matchdict) if __name__ == '__main__': config = Configurator() config.add_route('hello', '/hello/{name}') config.add_view(hello_world, route_name='hello') app = config.make_wsgi_app() server = WSGIServer('0.0.0.0', 8080, app) server.serve_forever() Any bug reports and ideas on how it could be improved/changed are welcome. -- Alex K -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
