Playing with WSGI

These days i’m trying WSGI technologies with python. I was used to PHP, Apache/Lighttpd, FastCGI and these kind of things. But i felt that python was more powerful and could be a lot faster than PHP. I tried Django in the past, but it was a madness inside the framework. Django is very powerful, but you’re inside of a kind of jail, you can play inside and is very fast and pretty, but doing non-standard things is a problem. And the main problem was distributing or migrate your app to another server, that’s a hell. But i learned that Python can be much faster than PHP.

Now i’m wondering about WSGI, it’s new for me, i believe Django uses WSGI inside, and seems to be a cool technology for web applications.

When i decided to not support HTTP in bjsonrpc, the main reason was performance. HTTP includes lots of data in each call, and one single call (send, receive) is done using the same connection. That is  a lot of overhead in bandwidth, connection and CPU. But HTTP is great for other things that doesn’t require that performance. And i’m wondering about if it’s possible to use bjsonrpc under wsgi; but some features would be problematic because HTTP doesn’t handle more than one request per connection.

I don’t know if these could be handled using jsonprc v2 protocol, with an array of queries, or using cookies.

Anyway, the basic performance i got with WSGI (with a hello wolrd in python) is about 500 request per second, using Apache + mod_wsgi. Is pretty fast. (But using raw sockets in python is faster, of course)

So the conclusion is, WSGI is a good option to port bjsonrpc to HTTP.