CPU usage limit to systemd-nspawn container is not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lennart,
Thanks for the response.
I am fairly new to systemd, may be I am not familiar with exact systemd terminology.
I am starting the container using the command either "machinectl start appscont" or "systemctl status systemd-nspawn at appscont" after "systemctl daemon-reload"
override.conf is effective when it is placed in /etc/systemd/system/systemd-nspawn at service.d/
If I have file systemd-nspawn at appscont.service in /etc/systemd/system.control/systemd-nspawn at appscont.service.d, it is not effective, it's using the template file.
Please let me know, Where exactly am I supposed to drop-in and what should be the name of the unit file ?
Regards
Mahipal 

    On Wednesday, 18 July, 2018, 3:15:56 PM GMT-4, Lennart Poettering <lennart at poettering.net> wrote:  
 
 On Mi, 18.07.18 19:10, patlollamahipal at yahoo.co.in (patlollamahipal at yahoo.co.in) wrote:

>  Hi All,I am using systemd-nspawn(systemd version 237) to create a container in Yocto's embedded Linux environment on Cortex-A53
> 
> Content of the file
> 
> 
> /etc/systemd/system/systemd-nspawn\@.service.d/override.conf
> 
> is[Service]ExecStart=ExecStart=/usr/bin/systemd-nspawn --quiet --boot --link-journal=try-guest --machine=%i -n --property=CPUQuota=10%I am trying to load the CPU with 
> 
> sha1sum /dev/zero &
> 
> 
> or 
> 
> 
> for i in 1 2 3 4; do while : ; do : ; done & done
> 
> 
>  inside the container but the top command on host shows that always
> they are at 50% CPU usage altogether(4 sh processes and one sha1sum
> process, if only sha1sum process is started, it alone uses 50% if
> not 10% each) I am unable to understand if there is any other
> setting where this 50% limitation is coming from? And why CPU quota
> passed to systemd-nspawn is not effective?I also tried
> with /etc/systemd/system/systemd-nspawn at .service.d/cpu.conf, still
> the same result but if I pass MemoryMax=50M, process gets killed if
> i try to use more than 50M in total inside the container.If anyone
> knows please help. Thank

nspawn's --property= is only relevant if nspawn allocates a scope unit
for the container. But that's not what systemd-nspawn at .service is for:
in that case nspawn simply makes use of the service unit it is already
run in. This is documented in the man page, if you have a look.

Or in other words: in your unit file drop-in just place CPUQuota=
directly in your [Service] Section:

    [Service]
    CPUQuota=10%

And do not make any changes to ExecStart=.

Lennart

-- 
Lennart Poettering, Red Hat
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180718/7a73a4fb/attachment.html>


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux