0

In Elastic search why does the time taken varies?

Its okay if the time taken is high at first hit and reduces at next hits.

The time taken goes from 80 ms to 20 ms and again increases to 70?

Here is the sample

**"took": 17,**
    "timed_out": false,
    "_shards": {
        "total": 246,
        "successful": 245,

I am puzzled really didn't understand How and why? Thanks in advance?

Vishnu Ranganathan
  • 1,277
  • 21
  • 45

1 Answers1

1

Well, in your case you search through 246 shards, so either you have a) all of them on a single node, which would mean that the probably less than 246 cores on that node need to service all of these shards, or b) a cluster with multiple nodes.

In both cases, you will experience some variance in the responses you get due to different search queries, varying network latency, other processes fighting for resources (e.g. CPU), cache hits/misses, traffic from other users on the cluster, OS memory management, JVM garbage collection, ... the list is rather long and this kind of behavior is totally normal for a distributed system doing what Elasticsearch does.

If you have to maintain the system, go and define some SLAs that you want to adhere to. Then monitor those and as long as you are below that - don't worry. There are some options that you could look into, like tuning memory, thread pools, GC and cache settings, ... the list is rather long as well, but all of that requires that you first come up with an expectation on the behavior of your system, aka SLAs.

moxn
  • 1,790
  • 1
  • 15
  • 34
  • 1
    On top of that there are some very recent performance improvements — most relevant for your question is Adaptive Replica Selection: https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search.html#search-adaptive-replica Otherwise you might alternate between busy and less busy nodes explaining the change in response time. – xeraa Dec 16 '17 at 15:29