elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.23k stars 24.85k forks source link

thread_pool.search.queue_size does not work #98962

Closed HobbyBear closed 1 year ago

HobbyBear commented 1 year ago

Elasticsearch Version

elasticsearch-7.4.2

Installed Plugins

No response

Java Version

bundled

OS Version

Linux version 3.10.0-957.21.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Tue Jun 18 16:35:19 UTC 2019

Problem Description

I configured the queue size and thread pool size in elasticsearch.yml as follows

thread_pool.search.queue_size: 2
thread_pool.search.size: 2

Then I want to test the rejection of the search query. I loop through the following wildcard query 100 times (the matching string is long and the request takes a long time) to check the rejection of the request.

{
    "query": {
        "wildcard": {
            "name": {
                "value": "*Few foods naturally contain vitamin D, though some foods are fortified with the vitamin. For most people, the best way to get enough vitamin D is taking a supplement because it is hard to eat enough through food. Vitamin D supplements are available in two forms: vitamin D2Few foods naturally contain vitamin D, though some foods are fortified with the vitamin. For most people, the best way to get enough vitamin D is taking a supplement because it is hard to eat enough through food. Vitamin D supplements are available in two forms: vitamin D2*",
                "boost": 1.0,
                "rewrite": "constant_score"
            }
        }
    }
}

Through the threadpool api, I observed that the thread pool of search has indeed taken effect. There are two 2 threads that have been active all the time, but the number of rejects has not changed, and through the _nodes/stats api, it is observed that the number of search queues is far greater than the configuration The queue size is 2。

It looks like the request is still slowly waiting to be executed. My expectation is that the request should be rejected directly.

GET _nodes/stats
....
"search" : {
          "threads" : 2,
          "queue" : 300,
          "active" : 2,
          "rejected" : 7,
          "largest" : 2,
          "completed" : 250152
        },
...

Steps to Reproduce

Just like the problem description, you can reproduce the problem

Logs (if relevant)

No response

DaveCTurner commented 1 year ago

Thanks very much for your interest in Elasticsearch.

Quoting the bug report form:

Please also check your OS is supported, and that the version of Elasticsearch has not passed end-of-life. If you are using an unsupported OS or an unsupported version then the issue is likely to be closed.

Your issue relates to Elasticsearch version 7.4.2 which has passed end-of-life, so I am closing this. If you can reproduce this issue in a supported version then we will reopen it.