Search code examples
phpmongodbdriverblacklist

PHP Mongo connection Blacklisting


In the legacy PHP MongoDB Driver a connection can be blacklisted as mentioned in stack overflow question: MongoDB Blacklisted Fatal Error.

Does anyone know if this behavior also applies in PHP's supported MongoDB Driver ?


Solution

  • https://github.com/mongodb/mongo-php-driver/issues/519

    Short answer seems to be yes.

    The current driver uses libmongoc internally, which implements the Server Discovery and Monitoring specification. The PHP and HHVM drivers both use a single-threaded monitoring implementation, in which sockets are shared for monitoring and application usage (multi-threaded implementations have a separate pool of connection used exclusively for monitoring). This single-thread approach uses a five-second timeout for ignoring a server after encountering a network error, which is analogous to the blacklisting behavior of the legacy driver.