Does anyone use connection pooling in ElasticSearch8.5? How to use it?

Does anyone use connection pooling in Elasticsearch8.5? How to use it?

You don't need a connection pool.
If you are working in Java, just create one single instance for the client.

But under high concurrency, some queries take about 5 seconds

I believe the java client has a built in connection pool.

That makes you draw the conclusion that this is a client limitation and not a Elasticsearch server limitation?

Hello, which is the built-in connection pool? Thanks

I am not familiar with the internals. Have you looked at the code?

What is the took value in the response object when this is happening?

SearchResponse resp = elasticsearchClient.search(request, JsonData.class)
This line of code I monitored, when the concurrency is 1000, this line of code goes from the first 30 milliseconds to the last 6000 milliseconds.

Can you alter the code to check the response for the took value? It would be useful to see if this increases as the concurrency goes up or whether it stays flat. If it is increasing with increased concurreny, that could indicate that Elasticsearch is taking longer to respond and it may not be a client efficiency issue.

1 Like

It took basically 9 milliseconds when the concurrency was 100, and it was about 50 milliseconds when the concurrency was 200.

It took basically 9 milliseconds when there were 100 concurrencies, and about 50 milliseconds when there were 200 concurrencies, so the overall query took from the first 30 milliseconds to the last 6000 milliseconds.

I am not sure I understand. Are you talking about the request latency in the client or the took value from the response?

At 100 concurrent requests, what is the average measured latency in the client and what is the average of the took value extracted from the response payload?

At 200 concurrent requests, what is the average measured latency in the client and what is the average of the took value extracted from the response payload?

At 1000 concurrent requests, what is the average measured latency in the client and what is the average of the took value extracted from the response payload?

1 Like

In the process of concurrency from 100 to 1000, the average value of tok is from 10 milliseconds to 60 milliseconds, and the entire ElasticSearcClient request is from 50 milliseconds to 6000 milliseconds.

@dadoonet may correct me here, but I think took does not necessarily include the time the request is queued up within the cluster. As you are increasing the concurrency I believe it is therefore possible that the search queue in the cluster will grow and increase end-to-end latency. This could therefore still indicate that the cluster is the bottleneck. Do you have monitoring installed on the cluster so you can check the search queue size over time?

I think it's correct although I don't know the exact internals.

@maoqingjue what is the output of:

GET /_cat/nodes?v
GET /_nodes/stats

The client co.elastic.clients.elasticsearch.ElasticSearchClient is blocked. I looked at the underlying source code.

ElasticSearchClient is a blocking client

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.