Last active
December 15, 2017 15:18
-
-
Save paoloantinori/4e395bead94f0c1b2844cc52a4caf102 to your computer and use it in GitHub Desktop.
Cgroups for java on Fedora
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
export MY_CGROUP_NAME="java_build" | |
export MY_SUBSYSTEMS="cpu,cpuacct" | |
sudo cgcreate -t $USER:$USER -a $USER:$USER -g $MY_SUBSYSTEMS:$MY_CGROUP_NAME | |
sudo cgset -r cpu.cfs_period_us=1000 $MY_CGROUP_NAME | |
sudo cgset -r cpu.cfs_quota_us=1000 $MY_CGROUP_NAME | |
# ls -al /sys/fs/cgroup/$MY_SUBSYSTEMS/$MY_CGROUP_NAME/ | |
# cgexec seems not to work for me, so we are going to create explicitely a subshell and assign a cgroup to that process | |
bash | |
cgclassify -g $MY_SUBSYSTEMS:$MY_CGROUP_NAME $BASHPID | |
# verify it's working checking | |
# cat /proc/$BASHPID/cgroup | |
# if you want to delete the group (ignore the error) | |
cgdelete -g $MY_SUBSYSTEMS:$MY_CGROUP_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment