Search This Blog

cgconfig.conf example

The following is an example /etc/cgconfig.conf from an Ubuntu Precise box:

mount {
        cpu = /sys/fs/cgroup/cpu;
        cpuacct = /sys/fs/cgroup/cpuacct;
        devices = /sys/fs/cgroup/devices;
        memory = /sys/fs/cgroup/memory;
        freezer = /sys/fs/cgroup/freezer;
# The net cgroups are loadable modules so need adding to /etc/modules to start
        net_prio = /sys/fs/cgroup/net_prio;
        net_cls = /sys/fs/cgroup/net_cls;
}

group limited_processes {
        perm {
                admin {
                        uid = gomez;
                }
                task {
                        uid = gomez;
                }
        }
        cpu {
                cpu.cfs_period_us = 50000;
                cpu.cfs_quota_us = 8000;
        }
        freezer {}
        memory  {
                memory.limit_in_bytes = 512M;
                memory.soft_limit_in_bytes = 256M;
                memory.memsw.limit_in_bytes = 768M;
                memory.swappiness = 60;
        }
        net_prio { # Creating a cgroup in a subsystem with no parameters makes it easy to add parameters later
        }
}

Add the following to /etc/modules to start the network cgroups:

# Network cgroups
cls_cgroup
netprio_cgroup

Related post:
Throttling CPU usage with Linux cgroups

No comments :

Post a Comment

My profile on StackExchange