I’m encountering a problem where PHP code (using v1.6 of the PHP MongoDB library) is quickly hitting the 1.5k simultaneous-connection limit on my M10 account. Upon further inspection, it looks like it’s possible failing to reuse old connections and also failing to close connections, as when I do a graceful restart of Apache to make it close all of the inactive threads it suddenly drops all of the Mongo connections it was holding open.
I’ve done a fair amount of research trying to figure out what’s going on behind the scenes here, connection-wise. I found a bunch of documentation for the old MongoClient class talking about its connection persistence mechanisms (such as the official documentation or this article), but thus far I’ve been completely unable to locate any similar documentation for the newer MongoDB\Client library. Is there any documentation available on how the new library handles its connection persistence?
Specifically, I’d love it if there were a way to see whether any given MongoDB\Client instance is creating a new connection or reusing an old one. I found this pull request to the PHP MongoDB driver that should allow the persistence function to be turned off in the future, but that’s still a ways out.
Does anyone have any experience with this issue?