• Daniel Black's avatar
    my_getncpus based on threads available · fb01cc37
    Daniel Black authored
    Detecting the cpus based on sysconf of the online CPUs can significantly
    over estimate the number of cpus available.
    
    Wheither via numactl, cgroups, taskset, systemd constraints, docker
    containers and probably other mechanisms, the number of threads mysqld
    can be run on can be quite less.
    
    As such we use the pthread_getaffinity_np function on Linux and FreeBSD
    (identical API) to get the number of CPUs.
    
    The number of CPUs is the default for the thread_pool_size and a too
    high default will resulting in large memory usage and high context
    switching overhead.
    
    Closes PR #922
    fb01cc37
my_getncpus.c 2.04 KB