[Bug 2098831] Re: netplan apply very slow when there are many veth devices

Lukas Märdian 2098831 at bugs.launchpad.net
Mon Feb 24 12:11:51 UTC 2025


Thank you for this performance analysis. Did you already confirm that
the udevadm calls are the bottleneck here? How did you do that?

The problem with skipping over any interface not listed in the Netplan
configuration might be Netplan's matching logic and renaming of
interfaces.

We might not always know all the interfaces names that a
NetplanNetDefinition matches, especially if interfaces get renamed.

The netplan_netdef_match_interface() API [1] might be able to help with
that (netdef._match_interface() in Python bindings). So before executing
the udevadm calls, we could filter if the given interface is actually
relevant.

Would you be interested in working on such performance improvement as part of an upstream PR?
https://github.com/canonical/netplan/pulls

[1] https://netplan.readthedocs.io/en/stable/apidoc/inc-
netdef/#c.netplan_netdef_match_interface

** Changed in: netplan.io (Ubuntu)
   Importance: Undecided => Medium

** Changed in: netplan.io (Ubuntu)
       Status: New => Triaged

** Also affects: netplan
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to netplan.io in Ubuntu.
Matching subscriptions: foundations-bugs
https://bugs.launchpad.net/bugs/2098831

Title:
  netplan apply very slow when there are many veth devices

Status in Netplan:
  New
Status in netplan.io package in Ubuntu:
  Triaged

Bug description:
  my instance

  root at iZbp12x7bx8gp999t1zp62Z:~# cat /etc/os-release 
  PRETTY_NAME="Ubuntu 24.04.1 LTS"
  NAME="Ubuntu"
  VERSION_ID="24.04"
  VERSION="24.04.1 LTS (Noble Numbat)"
  VERSION_CODENAME=noble
  ID=ubuntu
  ID_LIKE=debian
  HOME_URL="https://www.ubuntu.com/"
  SUPPORT_URL="https://help.ubuntu.com/"
  BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
  PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
  UBUNTU_CODENAME=noble
  LOGO=ubuntu-logo

  netplan version:  1.1.1-1~ubuntu24.04.1

  
  add many veth in instance
  ```
  for nu in $(seq 20 2000);do                                                                                                                                                                                                           
     ip link add "veth${nu}" type veth peer name "vethoer${nu}"                                                                                                                                                                         
  done

  ```
  and execute  `netplany apply` command execution is slow

  root at iZbp12x7bx8gp999t1zp62Z:~# time netplan apply

  real    1m20.402s
  user    0m40.302s
  sys     0m22.891s

  in netplan_cli/cli/commands/apply.py function  command_apply  traverse
  all network card devices for UDEV processing  (udevadm', 'test-
  builtin' ...). I think this may not be necessary. Should we only
  process the devices in the netplan configuration file

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/2098831/+subscriptions




More information about the foundations-bugs mailing list