systemd vs cgroups for resource isolation by user program?

The name of the pictureThe name of the pictureThe name of the pictureClash 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.










share|improve this question





















  • 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














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.










share|improve this question





















  • 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












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.










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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
















  • 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















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Popular posts from this blog

How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

Trouble downloading packages list due to a “Hash sum mismatch” error

How do I move numbers in filenames, in a batch renaming operation?