Road

The road to hell is paved with good intentions.

This is the second of a four-part series on regrettable decisions we made when we designed PyMongo. This winter we're preparing PyMongo 3.0, and we have an opportunity to make big changes. I'm putting our regrettable designs to rest, and writing their epitaphs as I go.

Last week I wrote about the first regrettable decision, "start_request". Today I'll tell you the story of the second: PyMongo and Gevent.


The Invention Of "use_greenlets"

As I described in last week's article, I committed my first big changes to connection pooling in PyMongo in March 2012. Once I'd improved PyMongo's connection pool for multi-threaded applications, my boss Bernie asked me to improve PyMongo's compatibility with Gevent. The main problem was, PyMongo wanted to reserve a socket for each thread, but Gevent uses greenlets in place of threads. I didn't know Gevent well, but I forged ahead.