threadpool.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. `suggest`::
  14. For suggest operations, defaults to `fixed`,
  15. size `# of available processors`.
  16. `get`::
  17. For get operations, defaults to `fixed`
  18. size `# of available processors`.
  19. `bulk`::
  20. For bulk operations, defaults to `fixed`
  21. size `# of available processors`.
  22. `warmer`::
  23. For segment warm-up operations, defaults to `scaling`
  24. with a `5m` keep-alive.
  25. `refresh`::
  26. For refresh operations, defaults to `scaling`
  27. with a `5m` keep-alive.
  28. Changing a specific thread pool can be done by setting its type and
  29. specific type parameters, for example, changing the `index` thread pool
  30. to have more threads:
  31. [source,js]
  32. --------------------------------------------------
  33. threadpool:
  34. index:
  35. type: fixed
  36. size: 30
  37. --------------------------------------------------
  38. NOTE: you can update threadpool settings live using
  39. <<cluster-update-settings>>.
  40. [float]
  41. [[types]]
  42. === Thread pool types
  43. The following are the types of thread pools that can be used and their
  44. respective parameters:
  45. [float]
  46. ==== `cache`
  47. The `cache` thread pool is an unbounded thread pool that will spawn a
  48. thread if there are pending requests. Here is an example of how to set
  49. it:
  50. [source,js]
  51. --------------------------------------------------
  52. threadpool:
  53. index:
  54. type: cached
  55. --------------------------------------------------
  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. type: fixed
  72. size: 30
  73. queue_size: 1000
  74. --------------------------------------------------
  75. [processors]]

  76. [float]

  77. [[processors]]
  78. === Processors setting
  79. The number of processors is automatically detected, and the thread pool
  80. settings are automatically set based on it. Sometimes, the number of processors
  81. are wrongly detected, in such cases, the number of processors can be
  82. explicitly set using the `processors` setting.
  83. In order to check the number of processors detected, use the nodes info
  84. API with the `os` flag.