0

I have been searching for a while for information about how services are assigned to slices - it seems to be a very elusive subject, or maybe I'm not asking the right questions. I've come across How does systemd put sshd processes in slices?, which asks a similar question, but doesn't get an answer.

So, to be more concrete: Say, I want to control how much memory mysqld can grab. I know that there is a service file: mysql.service, and there are slice files, like system.slice etc. With systemd-cgls I can see mysql.service is listed under system.slice, but if I wanted to create a new slice, say db.slice, and put the mysql service into that one, how would I do that? Or if that is not the right way, how about system-db.slice?

j4nd3r53n
  • 154
  • 1
  • 9
  • If you just want to limit the amount of RAM the service can use, there's no need to mess with slices. – Michael Hampton Jul 08 '20 at 09:43
  • @MichaelHampton That is not my main ambition - I want to know how to mess with slices and other units in general. In fact, now that I think about it, I would like to find an complete reference to all unit files and the options one can put inside them. What I have found so far has been incomplete and vague. – j4nd3r53n Jul 08 '20 at 10:22
  • Eh? The systemd docs are thoroughly detailed and complete. – Michael Hampton Jul 08 '20 at 10:24
  • Perhaps I haven't looked closely enough, but I see eg. `Slice=system.slice` in one of my service files, but I can't find that option in the systemd docs – j4nd3r53n Jul 08 '20 at 10:34
  • https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html#Slice= – Michael Hampton Jul 08 '20 at 10:40
  • I found it, but not listed with the other options. A bit sloppy, I think; it doesn't say explicitly where the option can be used, but searching around it seems to under `[Service]` – j4nd3r53n Jul 08 '20 at 10:53
  • @j4nd3r53n `The resource control configuration options are configured in the [Slice], [Scope], [Service], [Socket], [Mount], or [Swap] sections, depending on the unit type.` Seems rather explicit to me. – Ginnungagap Jul 08 '20 at 13:41

0 Answers0