<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi there,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">First off, forgive me if this is documented or discussed somewhere already. I couldn’t find any reference to it in the man pages or in the mailing list archives, and I’m relatively new to this community so I could easily be missing something.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Context that can be skipped if you only care about the technical part of the question:<o:p></o:p></p>
<p class="MsoNormal">We’re building a customized linux environment using systemd as the init system, and we’ve found that some of the daemons that we’re including in said environment aren’t particularly good citizens in regards to their resource consumption
(admittedly most of those are the ones that have been written in house). As a result, while we try to track down and fix those bugs, we would like to limit the memory that processes are allowed to consume by default (with actual values in the .service files
overriding that default). While we understand that this is the sort of thing that’s probably best set individually per-daemon based on an understanding of how the daemon should behave, it would at least give us a starting point and would mean that a leaky
process would be the one that crashed (when it hit the memory limit), rather than taking down the whole system or the OOM killer selecting a different process that’s working correctly but still happens to be using more memory at the time.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We’ve been trying to encourage our developers to use memory accounting and MemoryMax, since we’re given to understand that’s applied to the entire cgroup’s memory usage for a given daemon’s slice. The documentation, however, doesn’t seem
to indicate that a default value for any of the memory variables can be set in the system.conf file, and some quick experimental testing seems to indicate that’s truly the case. There does seem to be support for setting the memory resource limit (limitas),
but my understanding is that wouldn’t apply to subprocesses that are spawned off by the parent daemon - they’d inherit the resource limit, but get their own instance of it (and I’m actually still trying to figure out if it would apply to threads, given the
way I’m given to understand Linux treats threads. For memory, it would probably still cap things, since they’re all in the same address space, but I’m unclear if that would be true of the other limits that can be applied).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Am I missing something and this is possible to set? Or is it something that’s come up and been rejected for some reason? Or has it come up and not been important relative to other development priorities? Or has it simply never come up because
we’re the first ones to want to do something so foolish?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Any insight that you could provide would be greatly appreciated! Thanks.<o:p></o:p></p>
<p class="MsoNormal">-Sean McKay<o:p></o:p></p>
</div>
</body>
</html>