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

perf: add caching for extension getter to enhance performance #7102

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

guqing
Copy link
Member

@guqing guqing commented Dec 2, 2024

What type of PR is this?

/kind improvement
/area core
/milestone 2.20.x

What this PR does / why we need it:

为扩展获取增加缓存以提高网站整体性能

在此之前,每个请求都要经过很多过滤器,而一些过滤器会获取扩展因此导致频繁查询扩展和扩展点定义拖慢了速度

测试情况

初始化一个全新环境,安装并启用以下插件和主题

通过 Apache Benchmark (ab) 进行 1w 次请求并发 100 个,测试访问首页,得到以下测试结果:

核心指标对比

指标 改进前 改进后 提升情况
总耗时 (Time taken) 27.030 秒 25.718 秒 减少约 4.9%
每秒请求数 (RPS) 369.96 req/sec 388.83 req/sec 提升约 5.1%
单请求平均耗时 270.298 ms 257.181 ms 减少约 4.9%
传输速率 (Transfer Rate) 6346.44 KB/s 6670.12 KB/s 提升约 5.1%

综合分析

  • 性能提升主要体现在:请求处理时间(Processing)、等待时间(Waiting)以及每秒请求数(RPS)均有 约5% 左右的提升。
  • 传输效率更高:通过更快的处理时间,传输速率提高了 5.1%。
  • 长尾请求优化显著:最大响应时间减少了约 14.9%,意味着极端情况下的性能更优。

Does this PR introduce a user-facing change?

为扩展获取增加缓存使网站整体性能提升 5% 以上

@f2c-ci-robot f2c-ci-robot bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Dec 2, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.20.x milestone Dec 2, 2024
@f2c-ci-robot f2c-ci-robot bot added the kind/improvement Categorizes issue or PR as related to a improvement. label Dec 2, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from LIlGG and wan92hen December 2, 2024 05:02
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Dec 2, 2024
Copy link

sonarqubecloud bot commented Dec 2, 2024

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.21%. Comparing base (eff73dc) to head (5faeab8).
Report is 71 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7102      +/-   ##
============================================
+ Coverage     56.99%   57.21%   +0.21%     
- Complexity     3999     4027      +28     
============================================
  Files           714      716       +2     
  Lines         24110    24226     +116     
  Branches       1585     1593       +8     
============================================
+ Hits          13742    13861     +119     
+ Misses         9756     9749       -7     
- Partials        612      616       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/approve

Copy link

f2c-ci-robot bot commented Dec 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 4, 2024
Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Dec 4, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit eb96912 into halo-dev:main Dec 4, 2024
8 checks passed
@guqing guqing deleted the refactor/cache-extension-getter branch December 4, 2024 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants