On Mon, Dec 1, 2008 at 11:09 AM, Alvaro Lopez Ortega
<[EMAIL PROTECTED]> wrote:
> On 01-dic-08, at 19:25, Christopher Grebs wrote:
>> I'm planning to push my whole infrastructure over to a Cherokee
>> based setup. But since there are many wsgi applications running I
>> would be pleased to let them run in the same way I did with my
>> apache setup. But with all advantages Cherokee provides (Load
>> Balancing, easy Administration etc.). I know that WSGI-Based
>> applications can run without any code patching on CGI/SCGI/FastCGI
>> and so on... But the way WSGI handles just everything is ingenious.
>
> Well, WSGI is certainly a really interesting thing. It allows
> developer to write web applications without having to worry about the
> protocol it uses underneath to communicate with the web server. That's
> a very good thing, actually.

Ah this is a very important distinction that I think confuses many
people coming from a mod_wsgi vs. FastCGI world.

Proxying/FastCGI/SCGI all define a language/platform agnostic protocol
for relaying HTTP requests & responses between a frontend server and
backend applications.

WSGI[1] defines a common Python interface for web applications.  Think
of it as the thinnest possible web framework.  Many (most?  hopefully
all?) Python web frameworks implement WSGI.  However, these frameworks
may in turn use FastCGI/SCGI to actually communicate with the frontend
web server because WSGI isn't a protocol.  Its an API.

So think of mod_wsgi as mod_python + a builtin WSGI API (although this
is an analogy, *not* a technical description!).  Maybe we should call
it "Mod Python: WSGI Edition."  ;-)

If you really like the idea of having HTTP + Python in the same
process, use a Python HTTP server like CherryPy[2] to replace
Apache+mod_wsgi in your stack.  Then simply Proxy HTTP requests
between CherryPy & Cherokee.

Running a busy site on a multi-core server?  Simply start multiple
CherryPy instances and let Cherokee load balance between them.  Need
to scale more?  Move the CherryPy instances to other servers and keep
Cherokee as the load balancer.  There was a good demonstration of this
principle at PyCon a few years ago.[3]

You could always use Apache+mod_wsgi behind Cherokee while you
migrate.  It would be the same as the CherryPy solution but with the
HTTP & WSGI bits implemented in C instead of Pure Python.[4]

If you don't really care about HTTP & Python living in the same
process (I'm guessing you really just like how easy mod_wsgi is to
setup compared to say, mod_python), take a deep breath and switch to
FastCGI/SCGI.  :-)

Disclaimer:  Like I've mentioned before.  I'm no FastCGI/WSGI pro.
Just someone going through the same thought process as the OP.  :-)

[1] http://www.python.org/dev/peps/pep-0333/\
[2] http://cherrypy.org
[3] http://www.polimetrix.com/pycon/slides/
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to