threadpool.asciidoc 3.6 KB

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