Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Announcement: new deployment option for your Pylons/Pyramid apps
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
askel  
View profile  
 More options Jul 15 2012, 1:31 am
From: askel <dummy...@mail.ru>
Date: Sat, 14 Jul 2012 22:31:48 -0700 (PDT)
Local: Sun, Jul 15 2012 1:31 am
Subject: Announcement: new deployment option for your Pylons/Pyramid apps
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »