As org.elasticsearch.threadpool. ExecutorBuilder#applyHardSizeLimit method shown that write threadpool holds a controllable core thread count, default could not over 32.
but search will return an unlimit max size which means that when queue is full, thread will be created ulimitly. So why search threadpopl designed like this?
A fixed thread pool means that it limits the number of threads. It will queue up tasks until a thread becomes available. If the queue becomes full it will reject further requests with a 429 error. A scaling thread pool can create unlimited threads.
In version 5.4.1. if someone config thread_pool.search.size=1000(or bigger) by accident , there will be no limit on the maximum number of search threads (applyHardSizeLimit method shown that the max thread could reach Integer.MAX_VALUE),but if someone set thread_pool.index.size=1024 by accident, the index thread will not exceeding 32。 I mean maybe search thread should also do the same as index thread to protect this human error ?
There are some caveats still to having too many concurrent indexing
threads as it can lead to too many little segments...
AIUI this is why the number of indexing threads is more strictly bounded than most of the other thread pools: it leads to non-obvious performance issues that might persist even after the pool size is reduced. On the other hand if you want 1000 search threads and your node can't handle it then it will fail in much more obvious ways.
I'm wondering why this is of importance to you. If you don't want so many threads, don't ask for so many threads. I can't think of an easy way to choose a limit that protects the cases that need it without unduly limiting the cases that don't. There are other protections against OOMs (in more recent versions anyway) that should help here.
Just as I said, by accident, and some developer might didn't realize this problem。 And on the other hand, I want to know why index/bulk limit thread count but search don't, what will happen if search make this limit.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.