I have a JAVA service that wraps ES for specific queries behind an API. This means all requests are inspected by the facade and translated into ES queries via the JAVA API.
Creating a fresh RestClient for each incoming request seems a bit of an overhead to me. On the other hand I am not sure whether it is wise to channel all incoming requests through the same RestClient instance. On the other hand the implementation seems to be quite robust, thread-safe and provides some failover logic.
So what would be the recommended approach for this kind of setup? Channel all requests through a single instance? Create a pool of RestClients (Like an HTTP connection pool) or do something else? Should I do some kind of manual health check? Or is that already performed by the underlying HttpClient?
p.s.: Load on the facade is usually not very heavy and I don't assume more than 50 concurrent requests.