Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Celestica] Make 'sfputil show presence' faster #18041

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dal00
Copy link

@dal00 dal00 commented Feb 5, 2024

Why I did it

The is_host function is used when enumerating SFPs which was very slow when detecting if it was running inside docker. The following call makes the detection 10x faster.

How I did it

Instead of executing docker check for /.dockerenv which is present when inside a container.

How to verify it

Before patch:

  $ time sudo sfputil show presence
  Port         Presence
  -----------  -----------
  Ethernet0    Present
  Ethernet1    Present
  Ethernet2    Present

  -- snip --

  real    0m13.521s
  user    0m10.239s
  sys     0m4.104s

After patch:

  $ time sudo sfputil show presence
  Port         Presence
  -----------  -----------
  Ethernet0    Present
  Ethernet1    Present
  Ethernet2    Present

  -- snip --

  real    0m2.133s
  user    0m1.461s
  sys     0m0.347s

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

  • 202211

Description for the changelog

n/a

Link to config_db schema for YANG module changes

n/a

A picture of a cute animal (not mandatory but encouraged)

image

The is_host function is used when enumerating SFPs which was very slow
when detecting if it was running inside docker. The following call makes
the detection 10x faster.

Before patch:
  $ time sudo sfputil show presence
  Port         Presence
  -----------  -----------
  Ethernet0    Present
  Ethernet1    Present
  Ethernet2    Present

  -- snip --

  real    0m13.521s
  user    0m10.239s
  sys     0m4.104s

After patch:
  $ time sudo sfputil show presence
  Port         Presence
  -----------  -----------
  Ethernet0    Present
  Ethernet1    Present
  Ethernet2    Present

  -- snip --

  real    0m2.133s
  user    0m1.461s
  sys     0m0.347s

Signed-off-by: Tommy Nevtelen <tommy@nevtelen.com>
Copy link

linux-foundation-easycla bot commented Feb 5, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: dal00 / name: Tommy Nevtelen (721fa21)

@dal00 dal00 requested a review from lguohan as a code owner February 5, 2024 19:41
@dal00 dal00 changed the title [Celestica] Speed up docker detection [Celestica] Make 'sfputil show presence' faster Feb 19, 2024
@dal00
Copy link
Author

dal00 commented Apr 12, 2024

@lguohan Is there still something needed before this can be reviewed?

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.

2 participants