PHP SDK takes ages to establish connection to Couchbase
Hi everybody,
I'm having issue using the SDK for PHP.
If I try to estabilish a connection it takes ages...
Here some code:
$old = microtime (true);
$db = new Couchbase(...);
echo microtime (true)-$old."
";
$old = microtime (true);
$db->get(...);
echo microtime (true)-$old;
The output is this:
2.2835459709167 (couchbase establishing)
0.0011978149414062 (get command)
Why does the connection to couchbase take so long time?
The initial connect to Couchbase use the REST protocol connecting to the administration port to request the full layout of the cluster. This is unfortunately a relatively slow operation, but the good news is that you don't have to do that all of the times. If you use "persistent connections" (the last parameter to the constructor, and enabled by default in the upcoming release of the connector) it will cache these instances and reuse them (given that you provide the same arguments in the constructor).
that's is haven't seen this flag at the end of the Couchbase object...
Thx alot!
Hello,
Which version of PHP, SDK and OS are you using?
Thanks
Tug
@tgrall