threadpool.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. `search`::
  11. For count/search operations, defaults to `fixed`,
  12. size `3x # of available processors`.
  13. `get`::
  14. For get operations, defaults to `fixed`
  15. size `# of available processors`.
  16. `bulk`::
  17. For bulk operations, defaults to `fixed`
  18. size `# of available processors`.
  19. `warmer`::
  20. For segment warm-up operations, defaults to `scaling`
  21. with a `5m` keep-alive.
  22. `refresh`::
  23. For refresh operations, defaults to `scaling`
  24. with a `5m` keep-alive.
  25. Changing a specific thread pool can be done by setting its type and
  26. specific type parameters, for example, changing the `index` thread pool
  27. to `blocking` type:
  28. [source,js]
  29. --------------------------------------------------
  30. threadpool:
  31. index:
  32. type: blocking
  33. min: 1
  34. size: 30
  35. wait_time: 30s
  36. --------------------------------------------------
  37. NOTE: you can update threadpool settings live using
  38. <<cluster-update-settings>>.
  39. [float]
  40. === Thread pool types
  41. The following are the types of thread pools that can be used and their
  42. respective parameters:
  43. [float]
  44. ==== `cache`
  45. The `cache` thread pool is an unbounded thread pool that will spawn a
  46. thread if there are pending requests. Here is an example of how to set
  47. it:
  48. [source,js]
  49. --------------------------------------------------
  50. threadpool:
  51. index:
  52. type: cached
  53. --------------------------------------------------
  54. [float]
  55. ==== `fixed`
  56. The `fixed` thread pool holds a fixed size of threads to handle the
  57. requests with a queue (optionally bounded) for pending requests that
  58. have no threads to service them.
  59. The `size` parameter controls the number of threads, and defaults to the
  60. number of cores times 5.
  61. The `queue_size` allows to control the size of the queue of pending
  62. requests that have no threads to execute them. By default, it is set to
  63. `-1` which means its unbounded. When a request comes in and the queue is
  64. full, the `reject_policy` parameter can control how it will behave. The
  65. default, `abort`, will simply fail the request. Setting it to `caller`
  66. will cause the request to execute on an IO thread allowing to throttle
  67. the execution on the networking layer.
  68. [source,js]
  69. --------------------------------------------------
  70. threadpool:
  71. index:
  72. type: fixed
  73. size: 30
  74. queue_size: 1000
  75. reject_policy: caller
  76. --------------------------------------------------
  77. [float]
  78. ==== `blocking`
  79. The `blocking` pool allows to configure a `min` (defaults to `1`) and
  80. `size` (defaults to the number of cores times 5) parameters for the
  81. number of threads.
  82. It also has a backlog queue with a default `queue_size` of `1000`. Once
  83. the queue is full, it will wait for the provided `wait_time` (defaults
  84. to `60s`) on the calling IO thread, and fail if it has not been
  85. executed.
  86. [source,js]
  87. --------------------------------------------------
  88. threadpool:
  89. index:
  90. type: blocking
  91. min: 1
  92. size: 30
  93. wait_time: 30s
  94. --------------------------------------------------