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

[common] add PerformanceTimer #893

Merged
merged 2 commits into from
Nov 1, 2024
Merged

Conversation

a114j0y
Copy link
Contributor

@a114j0y a114j0y commented Jul 16, 2024

What I did

Extend the PerformanceIntervalTimer utility in sonic-sairedis repo to measure API performance.

To optimize performance of a periodically invoked function, we not only pay attention to how long it takes to finish execution (busy time), but also care about how long it waits to get executed (idle time). The total time determines the actual throughput in the real world system.

Hence we want to see data in 3 ways:

  1. Idle time between two calls (a gap between this start and the last end, during which the thread just waits)
  2. Busy time of each API call (interval between this start and this end, it's the true execution time)
  3. Total time elapsed (idle + busy)

| <- Initial Gap -> | <- - 1st **Execution** - -> | <- 2nd Gap -> | <- - 2nd **Execution** - -> |

| <---------------- 1st **Total** --------------> | <------------ 2nd **Total**--------------> |

Other features

  • calculate the number of tasks finished per call (Routes Per Second in the context of routes loading)
  • batch the logging output
  • adjust the SWSSLOGLEVEL using a file indicator, default level is "INFO", hence we could enable perf logs in a dynamic way.

Why I did it

  • original utility has limited functionality

    • we need gap data to obtain more insight on the mutual influence of upstream and downstream modules
  • original utility is in libsairedis, to use it in sonic-swss, there would be much Makefile.am change, not necessary.

  • a utility tool for swss should be included in swss-common

  • when enabled on-demand, it could help measure the API performance under scaled traffic

@a114j0y a114j0y changed the title add performancetimer into libswsscommon swss-common/common: add PerformanceTimer Jul 22, 2024
@a114j0y a114j0y changed the title swss-common/common: add PerformanceTimer [common] add PerformanceTimer Jul 22, 2024
@a114j0y a114j0y force-pushed the master branch 8 times, most recently from 50ac121 to f9bc905 Compare July 29, 2024 20:59
@eddieruan-alibaba
Copy link

eddieruan-alibaba commented Oct 20, 2024

@qiluo-msft @liuh-80 @lguohan can you help to review and approve it? We need this util PR in for other loading time PRs.

@lguohan lguohan merged commit c6364d1 into sonic-net:master Nov 1, 2024
17 checks passed
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.

5 participants