I’m just about to begin a new project where I’ll be using the Python client library in a multithreaded app. What do I need to be aware of when it comes to thread safety?
Since version 1.0.0-beta, the Python SDK is thread safe “out of the box” - meaning that you will not get any odd behavior if you try to use the same
Connectionobject from multiple threads.
That being said, if all of your threads are using Couchbase heavily, you may wish to consider implementing your own connection pooling. The SDK is only thread-safe but does not actually implement any pooling of its own (for now). One of the reasons the object is constructed via Couchbase.connect() and not via a simple constructor is to allow a possibility of connection pooling within the library. This is currently not yet implemented however.
For more information on the specifics of Couchbase and threads, see http://pythonhosted.org/couchbase/api/threads.html