apache / ignite

Apache Ignite
https://ignite.apache.org/
Apache License 2.0
4.77k stars 1.9k forks source link

Forcefully specify the number of CPUs #11472

Open pycgo opened 1 month ago

pycgo commented 1 month ago

^-- Cluster [hosts=1, CPUs=1, servers=1

Is there an environment variable that can set the number of machine CPUs perceived by IGNITE? Due to the inability to set CPU limit on cgroup1 and newer versions k8s, the number of CPUs obtained by IGNITE will always be 1,but The K8S machine has 8 CPUs。

ptupitsyn commented 1 month ago

Cgroups should work, I'm not sure about "inability to set CPU limit"

> docker run apacheignite/ignite
... CPUs=20 ...

> docker run --cpus 2 apacheignite/ignite
... CPUs=2 ...
pycgo commented 1 month ago

in centos7 cgroup1 && k8s 1.28, k8s yaml can not set cpu request limit ,and in almalinux9 cgroup2 && k8s 1.28 +,everything is ok

ptupitsyn commented 1 month ago

Ok, I see.

Is there an environment variable that can set the number of machine CPUs perceived by IGNITE

No, there is no such thing in Ignite. The closes thing is thread pool config: https://ignite.apache.org/docs/latest/perf-and-troubleshooting/thread-pools-tuning.

pycgo commented 1 month ago

Ok, I see.

Is there an environment variable that can set the number of machine CPUs perceived by IGNITE

No, there is no such thing in Ignite. The closes thing is thread pool config: https://ignite.apache.org/docs/latest/perf-and-troubleshooting/thread-pools-tuning.

Can these threads utilize all CPUs or only one CPU at a time ? when log print ^-- Cluster [hosts=1, CPUs=1, servers=1 ?

For example, as far as I know, ES has a similar configuration and is very effective in avoiding cgroup problems https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html#node.processors image

ptupitsyn commented 1 month ago

when log print ^-- Cluster [hosts=1, CPUs=1

This comes from the JVM, which gets it from the OS, so the answer is no. The OS won't allow the process to utilize more CPUs.

In other words, you can tweak an application to use less CPUs than available, but you can not break out of cgroup limits and use more.