Last active
December 16, 2020 10:21
-
-
Save corporatepiyush/55ecca29999cebbad2d58880cd376c90 to your computer and use it in GitHub Desktop.
Allocating CPU cores
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// suppose you spawned 16 node processes on 16 core CPU | |
ps axf | grep node | grep -v grep | awk '{print $1}' | xargs -n 1 taskset -cp 0-15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// suppose you have n nginx worker process and m other nginx related processes and numbe rof CPU cores is m+n | |
count=0 | |
for tbl in $(ps axf | grep nginx | grep -v grep | awk '{print $1}') | |
do | |
sudo taskset -cp $count $tbl | |
count=$((count+1)) | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// suppose you spawned n node processes on n core CPU | |
count=0 | |
for tbl in $(ps axf | grep node | grep -v grep | awk '{print $1}') | |
do | |
taskset -cp $count $tbl | |
count=$((count+1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment