ext/couchbase and persistent connections
I was wondering if I could get a little more information about of ext/couchbase.
A little background, I've been using Membase/Couchbase for about a year now as part of the backend for social games. To date, we've been using PECL Memcached on our app servers that connect to a stand-alone moxi proxy that then queries our Membase cluster. I've been looking into replacing ext/memcached with ext/couchbase, but there's a couple questions I haven't been able to find yet.
The first is would it be feasible to replace ext/memcached and the stand-alone moxi with just ext/couchbase? I know that ext/couchbase is a smart client and I get the impression that it does the same thing as moxi: do an internal lookup of the vbucket mapping and route the request to the correct server. Does that sound about right?
The second question has to do with persistent connections with ext/couchbase. In theory, I'd like to be able to open a connection, perform x number of get/sets, and then when the script finishes running and exits, the connection is closed/destroyed. I know that persistent connections are supposed to help with performance/resource usage (all good things in a social game setting), but I need to make sure I'm not going to run out of connections when there's high usage across a wide user base. So my question I guess is when exactly does a persistent connection get closed? Does it persist between script executions? Or does it behave more like a mysql connection in that once you connect the connection stays open until the script exits or the connection is closed manually?
Thanks!
First, on replacing ext/memcached with ext/couchbase and going around moxi, yep. That's exactly what it's supposed to do. It pulls the config (via libcouchbase via libvbucket) and routes to the right server.
On the second question, if the script exits the connection should be closed. Also, if you have multiple things going to Couchbase Server from a long running process, the connections will be shared/reused. There shouldn't be any problem with all of the connections getting consumed.
Give it a shot and let us know!