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

[sonic_py_common] Cache Static Information in device_info to speed up CLI response #26

Closed
wants to merge 5 commits into from

Conversation

vivekrnv
Copy link
Owner

@vivekrnv vivekrnv commented Aug 9, 2022

Why I did it

Profiled the execution for the following cmd intfutil -c status

Before Optimization:

root@msn-2410:/home/admin# time intfutil -c status
...................
...................
real    0m1.619s
user    0m1.221s
sys     0m0.203s

root@msn-2410:/home/admin#python3 -m cProfile -s tottime /usr/local/bin/intfutil -c status
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      124    0.007    0.000    1.318    0.011 device_info.py:353(get_platform_info)
      124    0.002    0.000    0.890    0.007 device_info.py:332(get_sonic_version_info)
      128    0.002    0.000    0.202    0.002 device_info.py:42(get_localhost_info)
      128    0.001    0.000    0.203    0.002 device_info.py:128(get_hwsku)
       62    0.000    0.000    0.014    0.000 device_info.py:449(is_chassis)

After Optimization:

root@msn-2410:/home/admin# time intfutil -c status
...................
...................
real    0m0.883s
user    0m0.622s
sys     0m0.128s

root@msn-2410:/home/admin#python3 -m cProfile -s tottime /usr/local/bin/intfutil -c status
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      124    0.000    0.000    0.013    0.000 device_info.py:360(get_platform_info)
        1    0.000    0.000    0.009    0.009 device_info.py:336(get_sonic_version_info)
        5    0.000    0.000    0.008    0.002 device_info.py:46(get_localhost_info)
        5    0.000    0.000    0.008    0.002 device_info.py:132(get_hwsku)
       62    0.000    0.000    0.015    0.000 device_info.py:446(is_chassis)

How I did it

  1. Cached the following information:
    • get_sonic_version_info()
    • get_platform_info()
  2. None of the API exposed to the user libraries has been modified

These methods involve reading text files or from redis. Thus, caching helped to improve the execution time

How to verify it

  • Added UT's.
  • Verified on the device

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

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

Description for the changelog

Link to config_db schema for YANG module changes

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

@vivekrnv vivekrnv closed this Aug 11, 2022
vivekrnv added a commit that referenced this pull request Dec 6, 2022
2fbe729 disable cfg dynamic change (#25)
13d0805 Use github code scanning instead of LGTM (#26)
1e846f6 Fix packet range check for relay-reply packets (#21)
4d19e13 (work/master, master) Add unittest infrastructure (#5)
7f4fdab fix packet range check issue (#20)
257ecdf Add client packet UDP header length check (#19)

Signed-off-by: Vivek Reddy Karri <[email protected]>
vivekrnv added a commit that referenced this pull request Dec 6, 2022
2fbe729 disable cfg dynamic change (#25)
13d0805 Use github code scanning instead of LGTM (#26)
1e846f6 Fix packet range check for relay-reply packets (#21)
4d19e13 Add unittest infrastructure (#5)
7f4fdab fix packet range check issue (#20)
257ecdf Add client packet UDP header length check (#19)

Signed-off-by: Vivek Reddy <[email protected]>
vivekrnv pushed a commit that referenced this pull request Dec 19, 2022
Added below commits:
9b30690 jcaiMR Fri Dec 16 fix handleSwssNotification crash in dhcp6relay (#28)
047afb7 jcaiMR Wed Dec 14 14:08:58 2022 +0800 Fix multiple vlan issue (#27)
ff6bec3 Vivek Thu Dec 8 09:44:15 2022 -0800 Made the Error log informative (#22)
2fbe729 jcaiMR Wed Nov 30 14:41:53 2022 +0800 disable cfg dynamic change (#25)
13d0805 Liu Shilong Wed Nov 30 10:54:11 2022 +0800 Use github code scanning instead of LGTM (#26)
1e846f6 kellyyeh Wed Nov 23 14:36:02 2022 -0800 Fix packet range check for relay-reply packets (#21)
4d19e13 kellyyeh Thu Nov 17 10:04:53 2022 -0800 Add unittest infrastructure (#5)
7f4fdab jcaiMR Fri Nov 11 14:47:51 2022 +0800 fix packet range check issue (#20)
257ecdf kellyyeh Thu Nov 3 11:34:11 2022 -0700 Add client packet UDP header length check (#19)
vivekrnv pushed a commit that referenced this pull request Mar 13, 2023


advance dhcp relay for 202211

4bf1868 - (HEAD, origin/master, origin/HEAD, master) fix relay-reply dhcpv6 packet counter issue (add support for a7050 qx32 platform #29) (2 weeks ago) [jcaiMR]
9b30690 - fix handleSwssNotification crash in dhcp6relay (Add libnl-nf-3-200 to docker-team #28) (4 weeks ago) [jcaiMR]
047afb7 - Fix multiple vlan issue (Failure trying to run: chroot /sonic-buildimage/fsroot mount -t proc proc /proc #27) (4 weeks ago) [jcaiMR]
ff6bec3 - Made the Error log informative (add python-tenjin as build dependency for p4-switch #22) (5 weeks ago) [Vivek]
2fbe729 - disable cfg dynamic change (p4: fix build dependency for python-p4c-bm #25) (6 weeks ago) [jcaiMR]
13d0805 - Use github code scanning instead of LGTM (Removed sx-libnl from Mellanox containers dependencies. #26) (6 weeks ago) [Liu Shilong]
1e846f6 - Fix packet range check for relay-reply packets (update sonic-swss and p4-switch submodule to fix docker sonic p4 bug #21) (7 weeks ago) [kellyyeh]
4d19e13 - Add unittest infrastructure (Cavium customization for docker containers #5) (8 weeks ago) [kellyyeh]
7f4fdab - fix packet range check issue (Makefile: add build dependency for python-p4c-bm #20) (9 weeks ago) [jcaiMR]
257ecdf - Add client packet UDP header length check (change port_config.ini directory for s6000 #19) (2 months ago) [kellyyeh]
vivekrnv added a commit that referenced this pull request Mar 18, 2024
Signed-off-by: Vivek Reddy Karri <[email protected]>
Co-authored-by: Vivek Reddy Karri <[email protected]>
vivekrnv pushed a commit that referenced this pull request Sep 11, 2024
…tically (sonic-net#20199)

#### Why I did it
src/sonic-dash-api
```
* 0b33087 - (HEAD -> master, origin/master, origin/HEAD) Add local region ID field to Dash appliance table (#26) (31 hours ago) [Mukesh Moopath Velayudhan]
```
#### How I did it
#### How to verify it
#### Description for the changelog
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