Setting network options (e.g. txqueuelen) for all containers via profile

Coming from How to increase the network bandwidth I want to improve local network performance for communication between containers/instance. The docs say:

You must also change the txqueuelen value for all Ethernet interfaces in your instances, in the same way as described for the LXD host.

What would be the best place to do this automatically for all instances? I thought about putting it into the lxd profile but I did not find an option that would allow this in the documentation.

Is it possible to add ifup commands via lxd profile or run some commands after container startup automatically?

@stgraber is this something we could add to the bridge, p2p and routed NIC types as a setting?

1 Like

Yeah, that’d be fine I think. I don’t want us to grow too many options either, but this one should be okay.

1 Like

Thanks.

Created Add support for setting txqueuelen on veth based NICs · Issue #11198 · lxc/lxd · GitHub

Should this be implemented to allow setting ifup and ifdown commands or only for txqueuelen?
ifup and ifdown would add a lot more flexibility with only two configuration options.

No just for txqueuelen we don’t utilize external call hooks by design.

E.g. Add support to call external hooks · Issue #3391 · lxc/lxd · GitHub

However in your case you maybe able to utilize a systemd-networkd config to configure the host-side interface (but not the instance side one) by setting a static host-side name by setting host_name setting in LXD for the NIC.

Or you could use the events API as described in that issue.

Thanks for the quick answer. For the host-sides I simply add the required code to my provisioning scripts. Containers are created dynamically on demand so I wanted them to have the setting automatically without the need to add additional provisioning or create custom images.

I understand your point on not supporting hook scripts, stability is a valuable good to keep :slight_smile:

Thanks for the hint about events, that’s very useful to me for some other things I’m going to build!

1 Like