Handling multiple connections (bucket instance)

HI,

I’ll be doing a project that will be built as microservices. My concern is the handling of connection between a microservice and multiple buckets across clusters (couchbase server version 5.1 ,&node sdk 2.6).

Currently, each request to microservice will pass bucket and cluster info, api will authenticate first before doing the actual querying / fetching, it works fine but it may cost a lot on a larger scale.

I’m planning to save each bucket instance for every first time request of each bucket/cluster credential then use the saved instance for the next request. Is it efficient? Or do you have other suggestion?

Thank you

Hey @nacion.emelson,

Your plan sounds reasonable. It is indeed a good idea to cache your Bucket objects in the 2.6 SDK as each Bucket object manages its own connections. Cacheing them on first use and then re-using them after that will significantly reduce the amount of time it takes to execute operations.

Cheers, Brett