threadpool.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. [[modules-threadpool]]
  2. == Thread Pool
  3. A node holds several thread pools in order to improve how threads are
  4. managed and memory consumption within a node. There are several thread
  5. pools, but the important ones include:
  6. [horizontal]
  7. `index`::
  8. For index/delete operations, defaults to `fixed`,
  9. size `# of available processors`.
  10. queue_size `200`.
  11. `search`::
  12. For count/search operations, defaults to `fixed`,
  13. size `3x # of available processors`.
  14. queue_size `1000`.
  15. `suggest`::
  16. For suggest operations, defaults to `fixed`,
  17. size `# of available processors`.
  18. queue_size `1000`.
  19. `get`::
  20. For get operations, defaults to `fixed`
  21. size `# of available processors`.
  22. queue_size `1000`.
  23. `bulk`::
  24. For bulk operations, defaults to `fixed`
  25. size `# of available processors`.
  26. queue_size `50`.
  27. `percolate`::
  28. For percolate operations, defaults to `fixed`
  29. size `# of available processors`.
  30. queue_size `1000`.
  31. `snapshot`::
  32. For snapshot/restore operations, defaults to `scaling`
  33. keep-alive `5m`,
  34. size `(# of available processors)/2`.
  35. `snapshot_data`::
  36. For snapshot/restore operations on data files, defaults to `scaling`
  37. with a `5m` keep-alive,
  38. size `5`.
  39. `warmer`::
  40. For segment warm-up operations, defaults to `scaling`
  41. with a `5m` keep-alive.
  42. `refresh`::
  43. For refresh operations, defaults to `scaling`
  44. with a `5m` keep-alive.
  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.