From Couchbase’s documentation, it is suggested applications should keep
Bucket instances as singletons.
I am currently in the process of redesigning an ASP.NET Web API application (.NET Framework 4.6.1) in which every HTTP request has to read data from our Couchbase database. The application must be able to serve many parallel HTTP requests at the same time.
I used to keep our
Bucket instances as singletons but the application experienced abnormally high lock contention rate (~200-300 contentions/sec with ~30 parallel HTTP requests) on the singletons under moderate/high load.
What is the recommended approach to manage lifetimes of
Bucket instances in this situation?