3

I'd like to limit the total memory used by user www-data in Ubuntu Server 14.04 LTS. I've read that I can do this via cgroups.

This is what I've done so far:

# install
apt-get install cgroup-bin

# create group for user www-data
cgcreate -a 'www-data' -g memory,cpu:'www-data'

# validate that the cgroup fs was created
ll /sys/fs/cgroup/cpu/www-data
ll /sys/fs/cgroup/memory/www-data

# adjust cpu and memory
echo 100 > /sys/fs/cgroup/cpu/www-data/cpu.shares
echo 100000000 > /sys/fs/cgroup/memory/www-data/memory.limit_in_bytes

Now what? How do I enforce these settings to user www-data?

edit: Note that if there is a better/best way to do this via other means (e.g systemd) then please suggest it.

1 Answer 1

0

Enforcing the setting to the process would make more sense

sudo cgexec -g cpu:cpulimited /usr/sbin/apachectl start
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .