boot delays, nmbd maybe sleeping excessively
This might not be the right place to raise this - it might be better sent to a samba user list, but... On tumbleweed I've noticed that nmbd consistently delays booting to the login prompt by several seconds. Systemd-analyse blame and systemd-analyse critical chain report numbers such as: 5.295s nmb.service 3.036s systemd-fsck-root.service 2.419s systemd-udev-settle.service The critical chain to graphical target is reported as 11.344s. If I disable smbd and nmbd this drops to 7.360s. Looking at its source code, nmbd appears to sleep(5) in three places while waiting for interfaces to become available: find ./samba/source3/nmbd -type f | xargs grep sleep ./samba/source3/nmbd/nmbd.c: sleep(5); ./samba/source3/nmbd/nmbd_subnetdb.c: sleep(5); ./samba/source3/nmbd/nmbd_subnetdb.c: sleep(5); I wonder if these sleep intervals might safely be set a bit shorter or even be made configurable via config or getenv? Would such changes be considered for TW, or would they have to be proposed upstream to the samba folk? Michael
On Sat, Mar 6, 2021 at 5:32 AM Michael Hamilton <michael@actrix.gen.nz> wrote:
This might not be the right place to raise this - it might be better sent to a samba user list, but...
On tumbleweed I've noticed that nmbd consistently delays booting to the login prompt by several seconds. Systemd-analyse blame and systemd-analyse critical chain report numbers such as:
5.295s nmb.service
3.036s systemd-fsck-root.service
2.419s systemd-udev-settle.service
The critical chain to graphical target is reported as 11.344s. If I disable smbd and nmbd this drops to 7.360s.
Looking at its source code, nmbd appears to sleep(5) in three places while waiting for interfaces to become available:
find ./samba/source3/nmbd -type f | xargs grep sleep ./samba/source3/nmbd/nmbd.c: sleep(5); ./samba/source3/nmbd/nmbd_subnetdb.c: sleep(5); ./samba/source3/nmbd/nmbd_subnetdb.c: sleep(5);
Huh ? it *sleeps* waiting for what network interfaces to come up? doesn't poll or otherwise ask netlink for the network status? that's.. broken.. try ordering nmb after network-online.target and enable the relevant $networkmanagmenttool-wait-online.service
On Sunday 07 March 2021, Cristian Rodríguez wrote:
On Sat, Mar 6, 2021 at 5:32 AM Michael Hamilton <michael@actrix.gen.nz> wrote:
This might not be the right place to raise this - it might be better sent to a samba user list, but...
On tumbleweed I've noticed that nmbd consistently delays booting to the login prompt by several seconds. Systemd-analyse blame and systemd-analyse critical chain report numbers such as:
5.295s nmb.service
3.036s systemd-fsck-root.service
2.419s systemd-udev-settle.service
The critical chain to graphical target is reported as 11.344s. If I disable smbd and nmbd this drops to 7.360s.
Looking at its source code, nmbd appears to sleep(5) in three places while waiting for interfaces to become available:
find ./samba/source3/nmbd -type f | xargs grep sleep ./samba/source3/nmbd/nmbd.c: sleep(5); ./samba/source3/nmbd/nmbd_subnetdb.c: sleep(5); ./samba/source3/nmbd/nmbd_subnetdb.c: sleep(5);
Huh ? it *sleeps* waiting for what network interfaces to come up? doesn't poll or otherwise ask netlink for the network status? that's.. broken.. try ordering nmb after network-online.target and enable the relevant $networkmanagmenttool-wait-online.service
I guess the code may have a long heritage and might also be written to be portable to more than just modern Linux. I remember compiling samba for SGI boxes last century, so there's probably some pretty old code in there. By modern standards a hard coded sleep(5) does seem somewhat execessive. After experimentally changing the sleep()s to tiny usleep()s and rebuilding from srpm, I found this makes no difference. I used usleep() so I could use nm to check if the change made into the binary. So either nmbd is waiting legitimately or something else is causing the delay - maybe some sub-component, or maybe the browse master election (I tried rigging the election, but that did not help). Thanks for the suggestions on reording startup dependencies. I'm hesitant to overly customise my boot sequence. I will keep this option in mind because I feel I should one day figure out more of how systemd works. I've now spent roughly many thousands of boots worth of potential savings, I think I will call a halt to my own fiddling. I may ask about speeding up nmbd initialisation on the samba lists just to see if there's a simple answer.
participants (2)
-
Cristian Rodríguez
-
Michael Hamilton