0

I use high-level-rest-client as my java client in my applicaton, and just use it by autowiring highRestClient in my business service code, not unlike using some connection pool in database connecting. For now, its performance is ok, but I wonder whether the bottom implementation of the client have use some kinds of connection pools. If not, is there any need to implement connection pools using high-level-rest-client on my own to improve its performance?

ouflak
  • 2,458
  • 10
  • 44
  • 49
  • Hey man, I would advise you not to think about it for now (except if you "know" performance are going to be critical from the get go). Just build your thing make it work. If optimisation are needed, perform a thorough investigation of your bottle-neck. Don't go around solving problem you don't have. – Paulo Jan 04 '22 at 08:05
  • Anyway, could you please provide more details as to which client you are using ? which version of `ES` you are targeting etc etc... – Paulo Jan 04 '22 at 08:06
  • Thanks for your advising, by the way, i use version 7.9.3, it's maven configuration is as follows, org.elasticsearch.client elasticsearch-rest-high-level-client 7.9.3 – shoulong tan Jan 04 '22 at 14:27
  • Nice thanks. Put all those info in you question it makes it more readable. – Paulo Jan 04 '22 at 14:30
  • @Paulo Thanks for your advising, by the way, i use the ES java client elasticsearch-rest-high-level-client , the ES server version is 7.9.3. As for relational database like mysql, we got Alibaba Druid to reuse the connection to cut down the overhead of every creating connection to connect database, so i'm curious if there is any need to do the same thing as for ES, or its offical client has already taken it in consideration? – shoulong tan Jan 04 '22 at 14:46

1 Answers1

0

From the official Documentation RestHighLevelClient initialization, it looks like ES pools the connection.

The high-level client will internally create the low-level client used to perform requests based on the provided builder. That low-level client maintains a pool of connections and starts some threads so you should close the high-level client when you are well and truly done with it and it will in turn close the internal low-level client to free those resources. This can be done through the close

Pramod
  • 787
  • 4
  • 19