Elasticsearch RestHighLevelClient Slow on First Few Queries with AWS Elasticsearch

8/10/2021

I have a Spring Boot service which utilizes the RestHighLevelClient and builds a @Bean of the client. The bean is built correctly and searches are successfully submitted to the client and performed.

RestHighLevelClient(
        RestClient.builder(new HttpHost(host, port, "http")));

But during Kubernetes deployments, we are noticing that new pods that are released have a 5-6x response time bump on the initial queries and quickly level back to performant times. The current RestHighLevelClient implementation is based on ES's RestClient which has a readiness actuator for the cluster (not sure if connection pool is somehow validated as wel). For me that rules out if the first few queries are because the connection pool is allocated by the low level http Apache client and the connections aren't established until the first query(s), but I am not sure.

The ES cluster is getting traffic prior to releases, and that traffic is performant, which I believe rules out any ES Index/Cluster changes. Any guidance on this would be appreciated.

-- Bobshark
aws-elasticsearch
elasticsearch
kubernetes
resthighlevelclient
spring-boot

0 Answers