Performance connection cluster

Hi, I wanted to ask your advice:
Currently the service is up and running, at start time the clusters are initialized and the buckets opened.
Every 30 minutes dozens of leements are inserted and the connection remains always open.
I was thinking to modify this behaviour opening and closing the connection on every insert operation.
Could this solution improve the performance of my cluster ?

@Alessandro.79 are you saying ever 30 mins or every 30 seconds? If its 30 seconds, this is our built-in app level keepalive to detect inactive or dead connectons. This has been made to keep you safe and your system more stable. We keep the connections open because it is much faster for operations to reuse an open socket rather creating a new one.

So while this is not even possible with the client (closing them on every request) it would give you worse performance . What is your usecase/problem that you are investigating better performance in the first place?

1 Like

I meant every 30 minutes (10-100 documents per insert operation).

@Alessandro.79 you are inserting them? why?

A small recap:
we are using couchbase to account all the calls to our services.
Every 30 minutes every single service (the client for couchbase) inserts the collected data into the couchbase cluster.
What I have found client side is a lot of open connections to the couchebase cluster. How can i reduce this number ?
Open and close connections could be a solution ?

Can you clarify what the problem with open tcp sockets is? Are you experiencing issues because of this?

One approach you could do is to fully shutdown the client and then bring it back online when needed. But this only really works if you have 30 min no taffic otherwise you’ll run into trouble. Keep in mind that recreating the client takes time and resources on both the client and the server.

Personally I’d leave it as is, unless you have actual issues because of the number of connections

Now i have a 3000 connection on each service … for total 16.6K connections on cluster.
In some services occur randomly that I get a connection timeout to cluster and this causes many problems.
For this I thought to optimize connection…

Are you saying each SDK is opening 3000 connections to the cluster? I hope you are only ever creating one CouchbaseCluster and Bucket instances and them sharing across your application, not opening new ones every time.

Ok thanks,
I’ll try to share a cluster connection into my application.

Note that this is the recommended way to use it, you’ll end up with better performance and way less connections

1 Like