bitly / asyncmongo

An asynchronous library for accessing mongo with tornado.ioloop
http://github.com/bitly/asyncmongo
Apache License 2.0
610 stars 106 forks source link

block request when reach the maxConnections #47

Open noca opened 12 years ago

noca commented 12 years ago

Hello, asyncmongo does a very brilliant work!

Now I'm encountered a problem that troubles me. I'm using mongos as a cluster proxy, and when the rqs is up to 2000r/s, the mongos occupied all system memory and when the rqs get higher, the request get "connection reset pee'.

And I looked at the source code of connection pool asyncmongo used, and I got that when the request reached out the maxConnections, the request will failed by the driver. But if I enlarge the maxConnections, the mongos will report error like before for that mongos manipulate each request by a thread.

Why not implement the connection pool to block the request when reach the maxConnections like Spring database connection pool implemented in JAVA instead of return an error ?

FlorianLudwig commented 12 years ago

I think this is the same issue as #42, #45 and #46. The later two include a pull request to solve this. Please test if one of those solve your problem.

noca commented 12 years ago

That is what exactly I want! Thanks a lot, FlorianLudwig~~ And by the way, will this patch get into the trunk of the souce code?

FlorianLudwig commented 12 years ago

You are welcome, glad I could help. I don't know if this gets merged into master, I am not the maintainer of asyncmongo.