Interview Prep/Linux/Kernel Parameters, Namespaces & cgroups

How do you apply cgroup limits using systemd?

IntermediateConceptKernel Parameters, Namespaces & cgroups
Answer
sudo systemctl set-property api.service MemoryMax=1G CPUQuota=150% TasksMax=512
systemctl show api -p MemoryMax -p CPUQuotaPerSecUSec
systemd-cgtop            # live per-cgroup resource usage

Or in the unit file [Service] section. CPUQuota=150% allows 1.5 CPUs. set-property persists via a drop-in unless you add --runtime.

All Linux questions Roadmap: Linux

More on Kernel Parameters, Namespaces & cgroups