Too many files open exception

I was using spymemcached client, and since our application uses Websphere MessageBroker where we access the cache, each request is a new thread, so we ran into trouble. The spymemcached client does not do connection pooling so we ran out of connections. Upping the open file count for user and process extended it a bit and still we had to catch the errors and restart more often than we liked.

So the question is, does couchbase have a connection pool or should we do client.shutdown() for each thread destruction?



Couchbase Java client has a “connection pool”, to be exact it is not a pool of connection but a non blocking API based on Netty, so you just need a singleton per VM


Yes a singleton was the solution.


just like change "client = new CouchbaseClient((CouchbaseConnectionFactory) cf);"
to “client = getInstance((CouchbaseConnectionFactory) cf);”??

so we don’t have shundown the CouchbaseClient everytime?

so if the CouchbaseClient is singleton,we can’t shutdown the client,right?