systemd vs cgroups for resource isolation by user program?

Clash Royale CLAN TAG#URR8PPP up vote
1
down vote
favorite
Environment: kubuntu desktop 17.10.1
Immediate goal: run chrome in such a way as to limit its maximum memory consumption.
Current workaround: I put the following in /usr/local/bin/cchrome:
#!/bin/sh
sudo mkdir -p /sys/fs/cgroup/memory/chrome
sudo chown -R ji /sys/fs/cgroup/memory/chrome
echo 8G > /sys/fs/cgroup/memory/chrome/memory.limit_in_bytes
exec cgexec -g memory:chrome google-chrome
I then edit my applications menu to create an entry called cchrome, and things are great! If I were less lazy, I would even had created the cgroup at startup so I wouldn't have to invoke sudo in the script.
This works, but it's ugly. According to TFM (man cgrules.conf and man cgconfig.conf), I should be able to set things up so that when chrome starts up, it runs in its own cgroup. However, these files do not exist in 17.10 desktop or 16.04 LTS server. AIUI, systemd does its own cgroup management.
I haven't been able to find any documentation on how to do this, and every google search hit on the subject is either about some workaround, does not work, or is for some other linux distribution.
kubuntu google-chrome cgroup
add a comment |Â
up vote
1
down vote
favorite
Environment: kubuntu desktop 17.10.1
Immediate goal: run chrome in such a way as to limit its maximum memory consumption.
Current workaround: I put the following in /usr/local/bin/cchrome:
#!/bin/sh
sudo mkdir -p /sys/fs/cgroup/memory/chrome
sudo chown -R ji /sys/fs/cgroup/memory/chrome
echo 8G > /sys/fs/cgroup/memory/chrome/memory.limit_in_bytes
exec cgexec -g memory:chrome google-chrome
I then edit my applications menu to create an entry called cchrome, and things are great! If I were less lazy, I would even had created the cgroup at startup so I wouldn't have to invoke sudo in the script.
This works, but it's ugly. According to TFM (man cgrules.conf and man cgconfig.conf), I should be able to set things up so that when chrome starts up, it runs in its own cgroup. However, these files do not exist in 17.10 desktop or 16.04 LTS server. AIUI, systemd does its own cgroup management.
I haven't been able to find any documentation on how to do this, and every google search hit on the subject is either about some workaround, does not work, or is for some other linux distribution.
kubuntu google-chrome cgroup
What is wrong with the solutions for "other linux distributions"? Do they not work on Ubuntu ?
â Panther
Mar 12 at 5:48
They assume the existence of /etc/cgroup.conf and /etc/cgconfig.conf, neither of which exist on ubuntu and , if created, are ignored.
â JayEye
Mar 13 at 3:52
Sorry I do not know a better method perhaps file a bug report if the config files are ignored.
â Panther
Mar 13 at 4:10
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Environment: kubuntu desktop 17.10.1
Immediate goal: run chrome in such a way as to limit its maximum memory consumption.
Current workaround: I put the following in /usr/local/bin/cchrome:
#!/bin/sh
sudo mkdir -p /sys/fs/cgroup/memory/chrome
sudo chown -R ji /sys/fs/cgroup/memory/chrome
echo 8G > /sys/fs/cgroup/memory/chrome/memory.limit_in_bytes
exec cgexec -g memory:chrome google-chrome
I then edit my applications menu to create an entry called cchrome, and things are great! If I were less lazy, I would even had created the cgroup at startup so I wouldn't have to invoke sudo in the script.
This works, but it's ugly. According to TFM (man cgrules.conf and man cgconfig.conf), I should be able to set things up so that when chrome starts up, it runs in its own cgroup. However, these files do not exist in 17.10 desktop or 16.04 LTS server. AIUI, systemd does its own cgroup management.
I haven't been able to find any documentation on how to do this, and every google search hit on the subject is either about some workaround, does not work, or is for some other linux distribution.
kubuntu google-chrome cgroup
Environment: kubuntu desktop 17.10.1
Immediate goal: run chrome in such a way as to limit its maximum memory consumption.
Current workaround: I put the following in /usr/local/bin/cchrome:
#!/bin/sh
sudo mkdir -p /sys/fs/cgroup/memory/chrome
sudo chown -R ji /sys/fs/cgroup/memory/chrome
echo 8G > /sys/fs/cgroup/memory/chrome/memory.limit_in_bytes
exec cgexec -g memory:chrome google-chrome
I then edit my applications menu to create an entry called cchrome, and things are great! If I were less lazy, I would even had created the cgroup at startup so I wouldn't have to invoke sudo in the script.
This works, but it's ugly. According to TFM (man cgrules.conf and man cgconfig.conf), I should be able to set things up so that when chrome starts up, it runs in its own cgroup. However, these files do not exist in 17.10 desktop or 16.04 LTS server. AIUI, systemd does its own cgroup management.
I haven't been able to find any documentation on how to do this, and every google search hit on the subject is either about some workaround, does not work, or is for some other linux distribution.
kubuntu google-chrome cgroup
kubuntu google-chrome cgroup
asked Mar 11 at 23:40
JayEye
723315
723315
What is wrong with the solutions for "other linux distributions"? Do they not work on Ubuntu ?
â Panther
Mar 12 at 5:48
They assume the existence of /etc/cgroup.conf and /etc/cgconfig.conf, neither of which exist on ubuntu and , if created, are ignored.
â JayEye
Mar 13 at 3:52
Sorry I do not know a better method perhaps file a bug report if the config files are ignored.
â Panther
Mar 13 at 4:10
add a comment |Â
What is wrong with the solutions for "other linux distributions"? Do they not work on Ubuntu ?
â Panther
Mar 12 at 5:48
They assume the existence of /etc/cgroup.conf and /etc/cgconfig.conf, neither of which exist on ubuntu and , if created, are ignored.
â JayEye
Mar 13 at 3:52
Sorry I do not know a better method perhaps file a bug report if the config files are ignored.
â Panther
Mar 13 at 4:10
What is wrong with the solutions for "other linux distributions"? Do they not work on Ubuntu ?
â Panther
Mar 12 at 5:48
What is wrong with the solutions for "other linux distributions"? Do they not work on Ubuntu ?
â Panther
Mar 12 at 5:48
They assume the existence of /etc/cgroup.conf and /etc/cgconfig.conf, neither of which exist on ubuntu and , if created, are ignored.
â JayEye
Mar 13 at 3:52
They assume the existence of /etc/cgroup.conf and /etc/cgconfig.conf, neither of which exist on ubuntu and , if created, are ignored.
â JayEye
Mar 13 at 3:52
Sorry I do not know a better method perhaps file a bug report if the config files are ignored.
â Panther
Mar 13 at 4:10
Sorry I do not know a better method perhaps file a bug report if the config files are ignored.
â Panther
Mar 13 at 4:10
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1014007%2fsystemd-vs-cgroups-for-resource-isolation-by-user-program%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What is wrong with the solutions for "other linux distributions"? Do they not work on Ubuntu ?
â Panther
Mar 12 at 5:48
They assume the existence of /etc/cgroup.conf and /etc/cgconfig.conf, neither of which exist on ubuntu and , if created, are ignored.
â JayEye
Mar 13 at 3:52
Sorry I do not know a better method perhaps file a bug report if the config files are ignored.
â Panther
Mar 13 at 4:10