How are CPUs counted in ES


(Logan) #1

I know that the number of thread pools are calculated by ES based on the
number of CPUs it detects. Does anyone know if ES makes a distinction
between physical and hyperthreaded cores? In other words will ES count a 8
core hyperthreaded CPU as 8 or 16 CPUs?

-Logan-

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(simonw-2) #2

we use this:

numCPUs = settings.getAsInt("processors", Math.min(32,
Runtime.getRuntime().availableProcessors()));

so whatever Runtime.getRuntime().availableProcessors() return is used. I
don't know from the top of my head if that is guaranteed to be physical, I
would think it depends on your system and the JVM?

simon

On Friday, October 11, 2013 7:23:36 PM UTC+2, Logan Hardy wrote:

I know that the number of thread pools are calculated by ES based on the
number of CPUs it detects. Does anyone know if ES makes a distinction
between physical and hyperthreaded cores? In other words will ES count a 8
core hyperthreaded CPU as 8 or 16 CPUs?

-Logan-

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #3

On Linux, if you use OpenJDK 7 or Oracle Java 7, the CPU cores are computed
with a sysconf call like in C

sysconf(_SC_NPROCESSORS_ONLN)

see also
http://www.gnu.org/software/libc/manual/html_node/Processor-Resources.html

This means, the currently online CPU cores are interpreted as
"availableProcessors()" in contrast to the installed ones.

http://hg.openjdk.java.net/jdk7/jdk7/hotspot/file/tip/src/os/linux/vm/os_linux.cpp

Other JVMs, especially OpenJDK 6, have a bug and may report "1" for
Runtime.getRuntime().availableProcessors() on chrooted environments
(typically VMs) because they examine the /proc folder instead of using the
sysconf call.

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4