Performance issues with lot of connections
<?php
$cb = new Couchbase("IP:8091", "cbroot", "XXXXXXX", "default");
echo time() . "
";
for ($i = 1 ; $i <= 2000 ; ++$i)
$cb->get("testXX");
echo time();
?>
when i call it from the browser 1-2seconds it do the job, is good.
but with this
<?php
$cb = new Couchbase("IP:8091", "cbroot", "XXXXXXX", "default");
$cb->get("testXX");
?>
and i test it with ab (apache benchmark) ab -n 2000 -c 20 http://..../
i get 20-25 seconds, i can put concurrency higher doesn't do a lot of difference, the bottleneck is not the nginx is running in one server just for itself and don't pass 10% CPU, but the server with couchbase just to itself it goes to 80-90% CPU. The only thing i can think is that the open and drop connections is very resource demanding.
I googled it and the only thing i found was this:
"Couchbase generally recommends that you create a connection pool from your application to the cluster and just re-use those connections versus creation and destroying them over and over. On heavier load applications, the creation and destruction of these connections over and over can get very expensive from a resource perspective."
@ http://stackoverflow.com/questions/10333539/couchbase-1-8-0-concurrency-...
I want to do some HTTP API in the middle to make a abstraction and to be used for a lot of different applications but i need 1k/s operations per second, that i benchmark and i know couchbase can handle that values, but i didn't expect this problem with the connections, is any support for persistence connections to couchbase with PHP?
Thank you a lot in advance