LXCFS 3.1.2 has been released

Usage:

lxcfs [-f|-d] -u -l -n [-p pidfile] mountpoint
  -f running foreground by default; -d enable debug output 
  -l use loadavg 
  -u no swap 
  Default pidfile is /run/lxcfs.pid

This shows that you need to pass -l to have loadavg enabled.

Is there a way to enable it on snap package lxd 3.16?

Not right now, but it’s something we certainly could offer as an option.

Can you file a bug at https://github.com/lxc/lxd-pkg-snap so I don’t forget?

How to configure LXD container to enable this?

Currently LA inside contaner looks the same as on the node.

Latest 3.18 LXD from SNAP.

Fairly certain you have to custom compile LXCFS still

The edge build has a suitable version of lxcfs with a config option for it snap set lxd lxcfs.loadavg=true && systemctl reload snap.lxd.daemon

This will make it to stable with the release of LXCFS 4.0.

2 Likes

Any chance of including that load avg in the 4.0 container info api ? :innocent:

Unlikely, as we mentioned before, even with lxcfs tracking it, there’s no clean way for LXD to retrieve the data which doesn’t involve accessing the container’s filesystem. Doing so is a big security risk we’d rather not take.

Thanks! Will set lxd lxcfs.loadavg=true work for the next LXD 3.19 or only for 4.0+ ?

This is not a LXD feature but a LXCFS feature, so you’ll need the next stable release of LXCFS which is going to be 4.0 in a couple of months.

well, but I found LXD 3.18 from snap stable already shipped with new lxcfs:

/snap/lxd/current/bin/lxcfs --version
3.1.2

But there is no documentation about new flags for snap about lxcfs.loadavg and other new flags. I googled it and still did not found anything about it.

snap info lxd shows only this block:

  **Configuration options**

  Supported options for the LXD snap (`snap set lxd KEY=VALUE`):
   - criu.enable: Enable experimental live-migration support [default=false]
   - daemon.debug: Increases logging to debug level [default=false]
   - daemon.group: Group of users that can interact with LXD [default=lxd]
   - ceph.builtin: Use snap-specific ceph configuration [default=false]
   - openvswitch.builtin: Run a snap-specific OVS daemon [default=false]

Is it documented at all? Where can I find info about other options? I think they might be helping me with a lot of tasks.

The list of flags listed by the store sometimes get out of date (which is annoying), the yaml in /snap/lxd/current/meta should have them all.

1 Like
snap set lxd lxcfs.loadavg=true
systemctl reload snap.lxd.daemon

/snap/lxd/current/bin/lxcfs --version
3.1.2
/snap/lxd/current/bin/lxc --version
3.18

lxc exec c99 uptime ; uptime
 15:12:10 up 26 days,  6:01,  0 users,  load average: 4.50, 6.02, 4.46
 15:12:11 up 32 days, 16:33,  1 user,  load average: 4.50, 6.02, 4.46

c99 is just created container without any load inside.
So load average from container and node is still the same. What I’m doing wrong?

The same with 3.19 fron snap:

root@d1:~# /snap/lxd/current/bin/lxcfs --version
3.1.2
root@d1:~# /snap/lxd/current/bin/lxc --version
3.19

root@d1:~# lxc exec c99 uptime ; uptime
 08:37:56 up 37 days, 12:58,  0 users,  load average: 2.06, 1.92, 1.95
 11:37:56 up 37 days, 12:59,  1 user,  load average: 2.06, 1.92, 1.95

root@d1:~# snap get lxd lxcfs.loadavg
true

ps aux | grep lxcfs

root@d1:~# ps aux | grep lxcfs
root      2874  0.0  0.0 458096  4672 ?        Ssl   2019   0:38 /usr/bin/lxcfs /var/lib/lxcfs/
root      3328  0.0  0.0 899380 13352 ?        Sl    2019  37:19 lxcfs /var/snap/lxd/common/var/lib/lxcfs -p /var/snap/lxd/common/lxcfs.pid

root@d1:~# apt remove lxcfs
...
Removing lxcfs (3.0.3-0ubuntu1~18.04.1) ...

root@d1:~# systemctl reload snap.lxd.daemon
root@d1:~# lxc exec c99 uptime ; uptime
 10:09:34 up 37 days, 14:30,  0 users,  load average: 1.79, 1.87, 1.89
 13:09:34 up 37 days, 14:30,  2 users,  load average: 1.79, 1.87, 1.89

root@d1:~# ps aux | grep lxcfs
root      3328  0.0  0.0 899380 13356 ?        Sl    2019  37:19 lxcfs /var/snap/lxd/common/var/lib/lxcfs -p /var/snap/lxd/common/lxcfs.pid

Right, lxcfs will not usually ever be restarted as doing so breaks all running containers.

You could stop all your containers, kill lxcfs and then reload the snap, that should cause it to be brought back up, this time respecting your config.

Thanks, now it’s working!

root@d1:~# lxc exec c99 uptime ; uptime
 13:44:33 up 1 min,  0 users,  load average: 0.00, 0.00, 0.00
 16:44:33 up 10 min,  2 users,  load average: 3.32, 2.83, 1.56

Good day!
@stgraber any specific reason this is not default setup? May be it consumes some extra resources and thus avoided by default?

That’s exactly right, this causes a non-negligible added load on lxcfs as it requires tracking all processes and their state which isn’t something that lxcfs would normally do.