I want to use RestHighLevelClient
on different clusters with commands which are not supported by Cross Cluster mechanizem (for example close and open index).
My question is if I use more than one instance of RestHighLevelClient
for every cluster it will keep connections open for every cluster? (to be ensure I didn't choke the application)
Is RestHighLevelClient keep connections open?
2.2k views Asked by Lupidon At
1
by looking at various resources, it seems
RestHighLevelClient
keeps the connection open unless you explicitly callclient.close();
on it.From the official RestHighLevelClient initialization
In your case, if you having a lot of ES clusters and creating multiple
RestHighLevelClient
than as you are guessing, it might choke your application due to the hold of threads and its resources so you should explicitly call theclose
which would require more time when you again create it but would not choke your application in most of the cases.I would suggest you do some resource benchmarking on your application and based on your trade-off choose the best possible approach.
close
clients frequently, this would not require over-allocating resources but when you create a new client for your request, latency will be more.