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: optimizing performance of router match with lrucache #8102

Merged
merged 11 commits into from
Oct 18, 2022

Conversation

tzssangglass
Copy link
Member

Description

Fixes # (issue)

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

apisix/core/improve.lua Outdated Show resolved Hide resolved
apisix/init.lua Outdated Show resolved Hide resolved
apisix/http/router/radixtree_uri.lua Outdated Show resolved Hide resolved
apisix/core/improve.lua Outdated Show resolved Hide resolved
apisix/core/improve.lua Outdated Show resolved Hide resolved
apisix/core/improve.lua Outdated Show resolved Hide resolved
apisix/core/improve.lua Outdated Show resolved Hide resolved
@membphis
Copy link
Member

and we should provide more information about the new performance before we merge this PR

@tzssangglass tzssangglass marked this pull request as ready for review October 18, 2022 02:28
@tzssangglass
Copy link
Member Author

tzssangglass commented Oct 18, 2022

The following tests were done on my development machine.

The number of workers is 1, disable access log, and disable the proxy-mirror and proxy-cache plugins, use one route

master branch:

Requests/sec:   9883.91
Transfer/sec:      1.81MB

Requests/sec:  10452.79
Transfer/sec:      1.91MB

Requests/sec:  10500.38
Transfer/sec:      1.92MB

flamegraph: master

perf

Requests/sec:  11641.22
Transfer/sec:      2.13MB

Requests/sec:  11447.80
Transfer/sec:      2.10MB

Requests/sec:  11415.72
Transfer/sec:      2.09MB

flamegraph:
perf

In this scenario, performance is improved by 10.87%

apisix/core/ai_plane.lua Outdated Show resolved Hide resolved
apisix/core/ai_plane.lua Outdated Show resolved Hide resolved
local route_flags = core.table.new(0, 2)
for _, route in ipairs(routes) do
if route.vars then
route_flags.vars = true
Copy link
Member

Choose a reason for hiding this comment

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

We could simplify it with an enable_ai_plane flag?

Suggested change
route_flags.vars = true
enable_ai_plane = false

Copy link
Member

Choose a reason for hiding this comment

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

in this case, enable_ai_plane is not a good name

membphis
membphis previously approved these changes Oct 18, 2022
apisix/core/ai_plane.lua Outdated Show resolved Hide resolved
@spacewander spacewander merged commit f058b25 into apache:master Oct 18, 2022
Liu-Junlin pushed a commit to Liu-Junlin/apisix that referenced this pull request Nov 4, 2022
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.

4 participants