Lxd process eating too much CPU for simple tasks


CPU usage on my hosts is very sensible, and I can see lxd process using really lot of cpu too often.

For example, a simple “lxc exec $vm exit 0” use 50% of a cpu core for one second.
We could say it’s not so much, but compared to the action completed (almost nothing), this is crasy.
Say I need to send a “exec” command on each VM on a host that have 100 VMs, the host is just CPU destroyed.
Never saw this behaviour with openvz.

A “lxc list” is also destroying the CPU (with 50-100 VMs running for example). I know we can use filters so I use it and it’s much better but still eating cpu with a simple “lxc list -c n” to list VMS names (25-30% of a cpu core for a second).

For me this is a real problem.
Anyone experiencing this ?


Which version of LXD is this?
How much free RAM do you have?

I’m on 3.8 version.
No matter of free ram, the problem is here even with 20GB available.

LXD 3.9 was released 12 days ago. It is strange that you did not get upgraded.
Can you look into that as well? They could be related. snap info lxd should help.

What distribution are you using?

Also, what storage driver do you use? How much free space is there?
There could be some issue with fragmentation. If you use ZFS, zpool list should show, for example, the fragmentation.

I have seen such issues when the RAM was exhausted. An Ubuntu container takes quite more memory than, let’s say, Ubuntu Minimal (https://blog.simos.info/a-closer-look-at-minimal-ubuntu-for-lxd/).