Python Multi-Process WSGI Server: Spawning 0.7

By Eric Larson
September 23, 2008 | Comments: 2

Ben pointed out Spawning the other day in IRC. It seems like a relatively new project, but it looks promising. My understanding is it uses the multiprocessing module that will be included in Python 3.0 in order to allow the use of multiple cores. Doug Hellmann wrote a good overview of the problem the processing module tries to solve.

UPDATE: I kind of blew it here in that Spawning does not use the processing module, but Eventlet. Thanks Ramiro for pointing it out!

This kind of project is why WSGI is such an important technology in the Python web development world. You can take any WSGI application and use this server out of the box. That means, if you are running into performance issues due to the GIL, running Pylons, TurboGears, etc. on this server is as easy as changing or adding a file. In fact, I moved to CherryPy because a memory leak seemed to show up when I used another Python web server. I wasn't able to nail down where the leak was, but I found using the CherryPy server fixed it and seemed a little faster. I didn't have to change any code other than how I started my server.

WSGI doesn't stop at the server though. It also helps in integrating tools as well. I can use the wealth of middleware components seamlessly, often without rewriting anything. I'll just add the middleware to my application and I'm done. This also goes for small bits of middleware that I write myself to solve domain specific issues. Just look at Pylons or TurboGears for some excellent examples creating powerful stacks for development. Mark Ramm made this very point at DjangoCon recently and I can't agree more.


You might also be interested in:

2 Comments

If you read the documentation or source code of Spawning you will see it uses Eventlet and not (multi)processing.

Thanks for catching that! I will update the post.

News Topics

Recommended for You

Got a Question?