What should the lifespan of IBucket be?

Hi Couchbase,

From previous conversations with ya’ll, it was recommended that a single instance of IBucket should be referenced and maintained for the lifetime of the application. My understanding was that it was relatively expensive to create/dispose instances since they establish a pool of socket connections to the cluster.

However, the documentation illustrates opening the bucket in a using statement.


Can you please provide some input on this?

@pkramer -

The documentation is just showing an example; in a real application it should be opened when the app starts and closed/disposed when the app shuts down. There is more depth on this subject in this page: https://docs.couchbase.com/dotnet-sdk/2.6/managing-connections.html


1 Like