Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance versus setting CPU affinity #111

Open
milahu opened this issue Jun 28, 2022 · 0 comments
Open

performance versus setting CPU affinity #111

milahu opened this issue Jun 28, 2022 · 0 comments

Comments

@milahu
Copy link

milahu commented Jun 28, 2022

why not use taskset to set CPU affinity?

The control of the used CPU amount is done sending SIGSTOP and SIGCONT POSIX signals to processes.

this sounds like a bad idea on a busy machine

lets say our machine has 100 cores
we use cpulimit to launch 2 processes, each process starts 100 workers

ideally each process would use 50 workers on 50 cores, so both can run perfectly parallel
but with cpulimit, the 2 processes block each other, because the cpu caches are constantly invalidated ...

n=$(nproc)
n2=$((n / 2))
echo nproc is $n

stress-ng --cpu $n --metrics --timeout 2s &
cpulimit -p$! -l$n2 -m &
stress-ng --cpu $n --metrics --timeout 2s &
cpulimit -p$! -l$n2 -m &

warning:
i just crashed a machine with these commands.
this seems to start a fork bomb

-bash: fork: retry: Resource temporarily unavailable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant