threadpool.asciidoc 3.6 KB

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