I’m using .net sdk and I wonder which is better to have a sigleton , or open and to dispose of the cluster and bucket each time you make a read and write operation , taking into consideration that the application is multi thread.
I suggest you use the ClusterHelper class and initialize when the app starts up and close it when the app shuts down. Here are some useful links:
This a long post, but towards the bottom there is some good information: SDK 184.108.40.206, Connection Pooling & Connection Timeouts
The reason you do not want to open/close a bucket on every use is because of the overhead associated with creating the TCP connections, bootstrapping and finally authenticating each connection. The ClusterHelper will create a singleton out of the Cluster object and then cache each bucket instance and reuse them over and over.