Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/_nodes/stats/indices/query_cache query_cache always empty #33191

Closed
leeeboo opened this issue Aug 28, 2018 · 7 comments

Comments

@leeeboo
Copy link

commented Aug 28, 2018

Elasticsearch version (bin/elasticsearch --version):6.4.0

Plugins installed: [analysis-ik]

JVM version (java -version):1.8.0_181

OS version (uname -a if on a Unix-like system):CentOS 7 4.18.3-1.el7.elrepo.x86_64

Description of the problem including expected versus actual behavior:

We have all cache metrics 0, such as:

/_nodes/stats/indices/query_cache

{
  "_nodes" : {
    "total" : 3,
    "successful" : 3,
    "failed" : 0
  },
  "cluster_name" : "weixinhost",
  "nodes" : {
    "6f0Kvy9VQf6pUdKpGc55_w" : {
      "timestamp" : 1535441875213,
      "name" : "node-2",
      "transport_address" : "172.31.100.174:9300",
      "host" : "172.31.100.174",
      "ip" : "172.31.100.174:9300",
      "roles" : [
        "master",
        "data",
        "ingest"
      ],
      "attributes" : {
        "ml.machine_memory" : "16026021888",
        "hdsize" : "300Gb",
        "xpack.installed" : "true",
        "az" : "cn-north-1a",
        "vmsize" : "r4.large",
        "ml.max_open_jobs" : "20",
        "ml.enabled" : "true"
      },
      "indices" : {
        "query_cache" : {
          "memory_size_in_bytes" : 0,
          "total_count" : 0,
          "hit_count" : 0,
          "miss_count" : 0,
          "cache_size" : 0,
          "cache_count" : 0,
          "evictions" : 0
        }
      }
    },
    ...
}

Steps to reproduce:

elasticsearch.yml

cluster.name:XXX
node.name: node-1
path.data: /elasticsearch/data
path.logs: /elasticsearch/log
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: [.............]
discovery.zen.minimum_master_nodes: 2
bootstrap.memory_lock: true

/INDEX/_settings

{
  "INDEX" : {
    "settings" : {
      "index" : {
        "refresh_interval" : "10s",
        "number_of_shards" : "9",
        "provided_name" : "follower-v2",
        "creation_date" : "1535191750932",
        "requests" : {
          "cache" : {
            "enable" : "true"
          }
        },
        "unassigned" : {
          "node_left" : {
            "delayed_timeout" : "5m"
          }
        },
        "number_of_replicas" : "0",
        "queries" : {
          "cache" : {
            "enabled" : "true"
          }
        },
        "uuid" : "CeBrVgGRQ42NA4QlgQNiLA",
        "version" : {
          "created" : "6030299"
        }
      }
    }
  }
}
@markharwood

This comment has been minimized.

Copy link
Contributor

commented Aug 28, 2018

You may want to review the difference between request caching and query carching.
Note that query caching only kicks in under certain conditions

Can you clarify what sorts of queries you are running, how frequently and if you think they meet the configured conditions for caching?

@elasticmachine

This comment has been minimized.

Copy link
Collaborator

commented Aug 28, 2018

Pinging @elastic/es-search-aggs

@xgwu

This comment has been minimized.

Copy link

commented Aug 29, 2018

@markharwood We experienced similar issue since upgrading a cluster from 6.2.4 to 6.3.0. All query cache stats stayed zeros according to metrics monitored.
image

The cluster is serving quite high query traffic that involves term/prefix/wildcard/ range filters. It just makes no sense there hasn't been any query cache activity.

I am aware that term filter is no longer cached since 6.1.1 but what about range filter? I tested running below range query multiple times on both 6.2.4 and 6.3.0 clusters.

{
  "query": {
    "constant_score": {
      "filter": {
        "range": {
          "age": {
            "gte": 30
          }
        }
      }
    }
  }
}

Query cache stats on 6.2.4 shows increment on cache count/size/hit, while on 6.3.0 all counters remain zeros.

@ekuwang

This comment has been minimized.

Copy link

commented Sep 1, 2018

@markharwood Sorry for the delay. We use these sorts of queries to test, and the query cache is always empty.

{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "sex": "1"
          }
        }
      ]
    }
  },
  "size": 1000
}
{
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "subscribe_dateline": {
              "gt": 1504228163,
              "lt": 1535764171
            }
          }
        }
      ]
    }
  },
  "size": 1000
}
@jasontedor

This comment has been minimized.

Copy link
Member

commented Sep 1, 2018

I can confirm that this is a bug, I know what the issue is and will open a fix soon.

@leeeboo

This comment has been minimized.

Copy link
Author

commented Sep 1, 2018

@jasontedor thanks

@elasticmachine

This comment has been minimized.

Copy link
Collaborator

commented Sep 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.