I was looking at the php docs on memcache and noticed that instead of doing
$mem->connect(\'localhost\', 11211)
I can do instead
$mem->addServer
The difference is actually explained quite well on the docs page for Memcache::addServer
connect() makes a direct connection to a single instance of memcached.
addServer() adds an entry to the server pool that the Memcache extension uses, but does not actually connect until you do something that requires a connection.
When using this method (as opposed to Memcache::connect() and Memcache::pconnect()) the network connection is not established until actually needed. Thus there is no overhead in adding a large number of servers to the pool, even though they might not all be used.
Using a server pool means that if one memcached instance/connection throws a low level error the Memcache extension will automatically connect to another server to make the request.