Hacker News new | ask | show | jobs
by j2d2j2d2 5445 days ago
J2 Labs is the name of my consulting company (and twitter account @j2labs).

Brubeck + DictShield are both projects that have risen from building API's for startups. I aim to make Brubeck as useful as possible for building web projects a quick and easy process, without sacrificing easy scaling.

My thinking here is that a solid model should help developers build their idea fast and make it through the early days of startups without breaking their backs.

I don't particularly like working with Tornado because it offers little support for the plethora of Python drivers that are blocking only. On top of that, the callback model, while powerful, can lead to some seriously confusing code.

I believe people will find the combination of Mongrel2, eventlet and a database agnostic modeling system (DictShield) very flexible.

2 comments

"...Tornado because it offers little support for the plethora of Python drivers that are blocking only."

Could you list an example of what you mean by support for blocking drivers? Thanks.

I guess what he means is that for drivers like mysql which are blocking only there is little support in tornado to not freeze the tornado instance during the request response cycle.
If you do use mysql, you're in luck... here's a pure python client module that can easily be monkey-patched for gevent/eventlet:

http://code.google.com/p/pymysql/

That is correct. Eventlet has database pooling for python drivers that are written in C.

See my response to your other comment for how eventlet handles drivers written entirely in Python. In short, it converts them.

A quick question ---

can i say use pymongo in Brubeck and you are saying the blocking nature of pymongo won't affect the async nature of Brubeck ??

For some reason my other account is blocked from responding so I created this one.

That is correct about pymongo. Eventlet will convert any drivers that are written entirely in Python into nonblocking driver. Gevent, an alternative to eventlet, can do the same. Brubeck supports both.

In addition to that it also makes ZeroMQ nonblocking. The combination of ZeroMQ support and pymongo, pyredis and pyriak all being available entirely as python (bson is in c tho) is what convinced me I had to write a new framework.

Your account is probably blocking you from responding because of some flamewar prevention feature Paul put in a while ago that makes it difficult for commenters to have nested discussions with one another--the deeper the discussion, the longer you have to wait before making a reply to a user who just replied to you.
Ahh...did not know that :)
wonderful.

Can you also shed light on thrift protocol ? i have struggled with the blocking nature of thrift(client).

Does eventlet convert blocking thrift client written in python to non-blocking ?

You know more about thrift than I do. If the "blocking" code is in python, eventlet should be able to fix it. You can't do anything about the native machine code, though. It appears that the client library includes a c-based codec to improve performance, but it should not be a problem if the transport is based on python sockets.
I use pymongo with gevent. A small hack is necessary to prevent pymongo from making a new connection for each thread that accesses mongodb (because with gevent, you can have a massive number of threads). I'd imagine the same is true with eventlet.
BTW, how is the performance compared to sync pymongo in your use? I'm testing with eventlet and seeing it about 10-20% slower.

https://gist.github.com/1088452

Do you mind sharing the details of that hack ??