elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.41k stars 24.56k forks source link

Set node.processors in containerized environments #100244

Open fcofdez opened 11 months ago

fcofdez commented 11 months ago

Currently if an Elasticsearch node runs in a container without cgroup's cpu_quota but with cpu_shares, the JVM will think that it has all the host processors available. We use that information to size the thread pools, using all the available threads in a possible multi-tenant host could be translated into CPU oversubscription in the host node. If we detect that cpu_shares are set in the cgroup FS (through /sys/fs/cgroup/cpu/cpu.shares) we should set node.processors using that value (and ideally -XX:ActiveProcessorCount too). Ideally, we should be able to use a configuration parameter to take into account the maximum allowed over-commit and adjust the number of processors based on that value. The value for node.processors must not be over the available number of processors in the host.

elasticsearchmachine commented 11 months ago

Pinging @elastic/es-core-infra (Team:Core/Infra)