Skip to content

Conversation

@rameshraghupathy
Copy link
Contributor

Improved show ip interface cli performance by listing only interfaces with ip, without affecting the existing behavior.

show ip interface was very slow at large scale because the code iterated all kernel netdevices and called netifaces.ifaddresses() per interface—even for L2-only ports without any IPs. With ~5k netdevices, this caused multi-minute runs or forced aborts.

What I did

Changed enumeration to only process interfaces that actually have IP addresses for the selected family.

Avoided per-iface sysfs reads (flags, carrier) unless the iface has at least one IP.

Kept CLI surface/output format and multi-ASIC behavior unchanged.

How I did it

Used ip -o -f inet|inet6 addr show to seed the set of (namespace, interface) that have addresses.

Built the BGP neighbor map as before; enriched rows only for those interfaces.

Read admin/oper/master state only for the filtered set.

Merged per-namespace results the same way as the original implementation.

How to verify it

time show ip interface > /dev/null (compute only)

time show ip interface | head (partial print)

time show ip interface (full print)

Expect ~4–12s depending on scale (previously minutes/aborts).

Previous command output (if the output of a command-line utility has changed)

No change

New command output (if the output of a command-line utility has changed)

No change

… wih ip without affecting the exsting behavior
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

… wih ip without affecting the exsting behavior
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kktheballer
Copy link
Contributor

Tested the fix on a testbed ToR and the latency of 'show ip interface' has substantially gone down. Using "ip -o addr show" cmd helps considerably

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@kktheballer kktheballer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the PR on a DUT and verified that 'show ip interface' lag was brought down from indefinitely long to 9-13 seconds which is great (tested using a scale of 428 subinterfaces)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants