Performance difference between Java High Level REST Client vs Low Level REST Client

I was doing a performance test on my system. In my test, Java High-Level Client makes ~800 RPS for a simple get request. When I change the implementation and use Java Low-Level Client, it reaches to ~1750 RPS. When I directly send the requests to ES for same get query I easy reach to ~8k RPS.
I am using 6.0.1

I wonder what I am doing wrong? Or is there performance difference on java client?

Let's see what @danielmitterdorfer is thinking about this. Please be patient on this as I know that Daniel is not available in the next days.

BTW could you upgrade to latest 6.2 so we are sure that you are using all the recent versions for both server and client?

I upgraded to latest version and repeat the tests. I got the same results :frowning:

Quite a while ago I have benchmarked the low-level REST client against the transport client for a blog post. The benchmarking code is available in the Elasticsearch repo. You can checkout the blog post for the benchmarking methodology that I have used there and inspect the code of the benchmark.

As far as I understand you have benchmarked three scenarios:

  • "Directly" sending requests to Elasticsearch: Not sure what this is, probably curl or just sending a raw string via a HTTP client library?
  • Low-level client
  • High-level client

W.r.t. to the use case: I am not so sure issuing a get request over and over is such a useful and realistic benchmark to begin with. If you need to retrieve a lot of documents by id, it would make sense to leverage batching and use the mget API instead.

It depends a bit how you setup your benchmark and measure but in general I'd expect that the high-level client is a bit slower because it needs to serialize and deserialize data? In your scenario it is quite a bit slower though. I suggest that you attach a Java profiler to the client application so you can see where the hot spots are (serializing data, sending them, establishing a connection, etc. etc). That might reveal further steps that you need to take.

Hope that helps!

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