Connection pooling .in couchbase using net sdk

Is doing connection pooling necessary using .net SDK or will it be handled internally ? Is there any limitations with specific version of couchbase for connection pooling?

@krishnaa

The Couchbase SDK does built-in connection pooling, which works with all versions of Couchbase. In fact, it is actually important that you keep a singleton for your Cluster object so that the pool remains active. You should not use the old ADO.NET pattern of disposing and opening the connection for every request.

@btburnett3 Thank you for your reply. Do you have any sample code for keeping a singleton cluster object

@krishnaa

Your best bet is to use the dependency injections extensions, assuming you’re using .NET Core DI. It’s documented here: Managing Connections using the .NET SDK with Couchbase Server | Couchbase Docs

1 Like