Connection pool example

#1

Heyo,

I’ve seen several times that it is recommended to roll your own connection pool when hitting CB from multiple threads or alike. While this seems to be something everyone say you should do, I didn’t find a nice example online for doing this. Is there one anywhere that I can start my own connection pool implementation with?

FWIW, I’m using the gevent python SDK.

Thanks

#2

As far as the Couchbase library is concerned, gevent does not need a connection pool. Since gevent under the hood uses a single threaded event loop model, the library (which natively uses an event loop) properly integrates with gevent.

Please note that while a greenlet may be a logical thread, as far as network I/O is concerned, it is cooperative. You only need to use a single connection throughout your program, and you will attain good performance.

There is an example of creating a connection pool in the github repository (https://github.com/couchbase/couchbase-python-client/blob/master/examples/connection-pool.py) but this does not apply to gevent