added MONGO_MAX_POOL_SIZE and MONGO_USE_GREENLETS parameters#15
added MONGO_MAX_POOL_SIZE and MONGO_USE_GREENLETS parameters#15akhenakh wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
This line doesn't seem to be doing anything ... typo?
|
Hey @ajdavis, I'm a little unfamiliar with how these arguments are intended to be used -- can you offer any insight as to whether this approach is workable and correct? |
|
Hey Dan! Summary: max_pool_size is fine, but leave validation up to PyMongo. Don't expose use_greenlets. max_pool_size is the horrifically-named option to control how many idle sockets the pool will keep open when they're returned to the pool (via end_request, or when a thread dies). So it's better thought of as "max idle sockets before I start closing any more that are returned to the pool." It's far, far less frequently useful than anyone thinks. I'd venture to call it useless. People want it to mean "max concurrent connections allowed," but PyMongo has no such option. However, if you want to make max_pool_size configurable this is a fine way to do it. I strongly recommend not validating it at all, since Connection or ReplicaSetConnection will much more thoroughly validate the parameter. Thus it's redundant and likely buggy to do your own validation here. use_greenlets: please don't set this. We're removing it from public view very soon. Our idea was that you could either do gevent.monkey.patch_all(), or use gevent and set use_greenlets=True. We've changed our minds and we can't think of any good reason not to just do patch_all(), so we're going to legislate that and hide use_greenlets as best we can. |
let pymongo Connection validate MAX_POOL_SIZE changed doc accordingly
|
Thanks @ajdavis and Dan |
There was a problem hiding this comment.
Per @ajdavis we should probably note that this is the maximum number of idle connections that will be left open.
|
Looks great other than my one last nitpick comment. |
|
Yeah. "The maximum size limit for the connection pool" is copied from PyMongo's docs, but that's a very unfortunately unclear description. I agree with @dcrosta . |
|
Thanks! Sorry it took me a while to get around to merging this. |
I'm using flask-pymongo with gevent and this parameters are usefull for tuning.