PHP-FPM & large number of connections to the couchbase cluster

We're currently facing some performance issues with our application and Couchbase is the culprit. One area we are looking at is the shear number of connections our application servers have with the couchbase cluster. My understanding is that each PHP-FPM process will create n+1 connections to the couchbase cluster where n is the number of nodes in the cluster. Since our application servers are configured to create 600 PHP-FPM processes that amounts to approximately 8000 connections for our 13 node cluster. Thankfully, in production, we only see it reach around 6000 connections.

How are others addressing this issue? We do have persistent connections turned on.

2 Answers

« Back to question.

Hi There,

This was quite a common problem for people using Couchbase with FPM & NGINX.

I wrote a blog addressing the issue and giving you the solution here:

http://blog.couchbase.com/using-nginx-php-fpm-couchbase-–-how-and-why

Hope this helps!

Robin.

« Back to question.

You should pool your connections to increase speed and reduce the number of port 8091 calls.

This post talks about it. http://www.couchbase.com/forums/thread/php-sdk-connection-pooling

Also I would recommend you do a shuffle command to your cb_array so not all connections go to the same server for the vbucket map.

EX.
$cb_array = array('1.1.1.1:8091','2.2.2.2:8091','3.3.3.3;8091');
shuffle($cb_array):
$cb = new couchbase($cb_array,'','password','bucket_name',true);