threadpool.asciidoc 3.9 KB

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