Alex G.
Alex G.

Reputation: 949

What does really happen on POST _cache/clear?

Sorry if my question is trivial as I'm not familiar with ES.

How should I interpret query_cache values if I clear cache between stats calls?

// GET _cluster/stats
{
    ...
    "indices": {
        ...
        "query_cache": {
            "memory_size_in_bytes": 229449664,
            "total_count": 19146885372L
            "hit_count": 18430071,
            "miss_count": 19128455301L,
            "cache_size": 4101,
            "cache_count": 126089,
            "evictions": 121988
        }
    ...
    }
    ...
}

// POST _cache/clear

// GET _cluster/stats
{
    ...
    "indices": {
        ...
        "query_cache": {
            "memory_size_in_bytes": 0,
            "total_count": 19146885372L
            "hit_count": 18430071,
            "miss_count": 19128455301L,
            "cache_size": 0,
            "cache_count": 126089,
            "evictions": 121988
        }
    ...
    }
    ...
}

As you can see memory_size_in_bytes and cache_size have been zeroed. What does that mean? Why cache_count has not been changed?

Upvotes: 0

Views: 218

Answers (1)

Val
Val

Reputation: 217344

Here is a short explanation for each values:

  • memory_size_in_bytes is the amount of memory occupied by queries in the cache
  • total_count is the total number of lookups in the cache (= hit_count + miss_count)
  • hit_count is the total number of cache HIT
  • miss_count is the total number of cache MISS
  • cache_size is the total number of queries currently in the cache
  • cache_count is the total number of cache lookups so far (= cache_size + evictions)
  • evictions is the total number of queries that have been evicted from the cache

So when you clear the cache, the only thing that you can really clear is the memory (i.e. memory_size_in_bytes) and the number of cached queries (i.e. cache_size). It doesn't really make sense to clear the other values as they are just counters.

Upvotes: 3

Related Questions