threadpool.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. [[modules-threadpool]]
  2. == Thread Pool
  3. A node holds several thread pools in order to improve how threads memory consumption
  4. are managed within a node. Many of these pools also have queues associated with them,
  5. which allow pending requests to be held instead
  6. of discarded.
  7. There are several thread pools, but the important ones include:
  8. `generic`::
  9. For generic operations (e.g., background node discovery).
  10. Thread pool type is `scaling`.
  11. `index`::
  12. For index/delete operations. Thread pool type is `fixed`
  13. with a size of `# of available processors`,
  14. queue_size of `200`. The maximum size for this pool
  15. is `1 + # of available processors`.
  16. `search`::
  17. For count/search/suggest operations. Thread pool type is `fixed`
  18. with a size of `int((# of available_processors * 3) / 2) + 1`,
  19. queue_size of `1000`.
  20. `get`::
  21. For get operations. Thread pool type is `fixed`
  22. with a size of `# of available processors`,
  23. queue_size of `1000`.
  24. `bulk`::
  25. For bulk operations. Thread pool type is `fixed`
  26. with a size of `# of available processors`,
  27. queue_size of `50`. The maximum size for this pool
  28. is `1 + # of available processors`.
  29. `percolate`::
  30. For percolate operations. Thread pool type is `fixed`
  31. with a size of `# of available processors`,
  32. queue_size of `1000`.
  33. `snapshot`::
  34. For snapshot/restore operations. Thread pool type is `scaling` with a
  35. keep-alive of `5m` and a max of `min(5, (# of available processors)/2)`.
  36. `warmer`::
  37. For segment warm-up operations. Thread pool type is `scaling` with a
  38. keep-alive of `5m` and a max of `min(5, (# of available processors)/2)`.
  39. `refresh`::
  40. For refresh operations. Thread pool type is `scaling` with a
  41. keep-alive of `5m` and a max of `min(10, (# of available processors)/2)`.
  42. `listener`::
  43. Mainly for java client executing of action when listener threaded is set to true.
  44. Thread pool type is `scaling` with a default max of `min(10, (# of available processors)/2)`.
  45. Changing a specific thread pool can be done by setting its type-specific parameters; for example, changing the `index`
  46. thread pool to have more threads:
  47. [source,yaml]
  48. --------------------------------------------------
  49. thread_pool:
  50. index:
  51. size: 30
  52. --------------------------------------------------
  53. [float]
  54. [[types]]
  55. === Thread pool types
  56. The following are the types of thread pools and their respective parameters:
  57. [float]
  58. ==== `fixed`
  59. The `fixed` thread pool holds a fixed size of threads to handle the
  60. requests with a queue (optionally bounded) for pending requests that
  61. have no threads to service them.
  62. The `size` parameter controls the number of threads, and defaults to the
  63. number of cores times 5.
  64. The `queue_size` allows to control the size of the queue of pending
  65. requests that have no threads to execute them. By default, it is set to
  66. `-1` which means its unbounded. When a request comes in and the queue is
  67. full, it will abort the request.
  68. [source,yaml]
  69. --------------------------------------------------
  70. thread_pool:
  71. index:
  72. size: 30
  73. queue_size: 1000
  74. --------------------------------------------------
  75. [float]
  76. ==== `scaling`
  77. The `scaling` thread pool holds a dynamic number of threads. This
  78. number is proportional to the workload and varies between the value of
  79. the `core` and `max` parameters.
  80. The `keep_alive` parameter determines how long a thread should be kept
  81. around in the thread pool without it doing any work.
  82. [source,yaml]
  83. --------------------------------------------------
  84. thread_pool:
  85. warmer:
  86. core: 1
  87. max: 8
  88. keep_alive: 2m
  89. --------------------------------------------------
  90. [float]
  91. [[processors]]
  92. === Processors setting
  93. The number of processors is automatically detected, and the thread pool
  94. settings are automatically set based on it. Sometimes, the number of processors
  95. are wrongly detected, in such cases, the number of processors can be
  96. explicitly set using the `processors` setting.
  97. [source,yaml]
  98. --------------------------------------------------
  99. processors: 2
  100. --------------------------------------------------
  101. In order to check the number of processors detected, use the nodes info
  102. API with the `os` flag.