Hi Folks,
I'm trying to optimise our boot process and have started to look at
the time it takes for the network to come up (a single interface to be
routable) when using systemd-networkd:
root@HOST:/# systemd-analyze critical-chain network-online.target --no-
pager
The time after the unit is active or started is printed after the "@"
character.
The time the unit takes to start is printed after the "+" character.
network-online.target @4.144s
└─systemd-networkd-wait-online.service @615ms +3.527s
└─systemd-networkd.service @582ms +30ms
└─systemd-tmpfiles-setup.service @315ms +63ms
└─local-fs.target @314ms
root@HOST:/#
So, here systemd-networkd-wait-online.service seems to run for 3.5s -
I had initially though this is due to the RTT for DHCP but in doing a
packet capture for DHCP this isn't the case:
me@DHCP-SERVER:~$ sudo tshark -i eth0 -f "(ether src 28:16:a8:fd:53:77
|| ether dst 28:16:a8:fd:53:77) && (port 67 || port 68)"
Running as user "root" and group "root". This could be dangerous.
Capturing on 'eth0'
1 0.000000000 0.0.0.0 → 255.255.255.255 DHCP 333 DHCP
Discover - Transaction ID 0x5c9e3cd0
2 0.000157300 192.168.3.3 → 192.168.3.16 DHCP 373 DHCP Offer -
Transaction ID 0x5c9e3cd0
3 0.000695601 0.0.0.0 → 255.255.255.255 DHCP 345 DHCP Request
- Transaction ID 0x5c9e3cd0
4 0.000771901 192.168.3.3 → 192.168.3.16 DHCP 373 DHCP ACK -
Transaction ID 0x5c9e3cd0
So, that's 700us from discover to ack.
We have 3 network interfaces, only enP8p1s0f0np0 is of use to us:
root@HOST:/# networkctl status -a --no-pager
● 1: lo
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: loopback
State: carrier (unmanaged)
Address: 127.0.0.1
::1
● 2: enP8p1s0f0np0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /etc/systemd/network/wired.network
Type: ether
State: routable (configured)
Path: platform-60400000.pcie-pci-0008:01:00.0
Driver: bnxt_en
HW Address: 28:16:a8:fd:53:77
Address: 192.168.3.16
2001:db8:0:1:2a16:a8ff:fefd:5377
fe80::2a16:a8ff:fefd:5377
Gateway: 192.168.3.1
fe80::7683:efff:fed4:935
DNS: 10.50.10.50
10.50.50.50
NTP: 10.222.184.12
Connected To: localhost on port Ethernet31/1
● 3: enP8p1s0f1np0
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: off (unmanaged)
Path: platform-60400000.pcie-pci-0008:01:00.1
Driver: bnxt_en
HW Address: 00:10:18:ad:05:01
root@HOST:/#
Networking configuration looks like this:
root@HOST:/# cat /etc/systemd/network/wired.network
[Match]
Name=eth* en*
[Network]
DHCP=v4
root@HOST:/# cat /etc/systemd/network/
blacklist_interfaces.network wired.network
root@HOST:/# cat /etc/systemd/network/blacklist_interfaces.network
[Match]
Name=enP8p1s0f1*
[Network]
DHCP=no
LinkLocalAddressing=no
IPv6AcceptRA=false
[Link]
RequiredForOnline=no
Unmanaged=yes
root@HOST:/#
Our version is:
root@HOST:/# systemctl --version
systemd 239
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP
+LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS
+KMOD -IDN2 -IDN -PCRE2 default-hierarchy=unified
root@HOST:/#
I've had a look at
https://github.com/systemd/systemd/blob/v239/src/network/wait-online/wait-online.c
and it really doesn't do much other than wait for the operational
state to be "routable".
Can anyone offer any suggestions for where I should look to try to
speed things up here?
Thanks!
Peter.
_______________________________________________
systemd-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/systemd-devel