Skip to content

Conversation

@Revolyssup
Copy link
Contributor

@Revolyssup Revolyssup commented Oct 30, 2025

There is a big performance difference between APISIX 3.10 and 2.13 when no plug-ins are enabled.
After comparing the flame graphs of APISIX 3.10 and 2.13 versions, it can be clearly seen that the biggest difference is in the pick_server function. After comparing the function codes of the two versions, it is found that the code of version 3.10 has added logic to traverse all upstream nodes, and when there are more upstream nodes during performance testing, so the difference is more obvious.

After backtracking the changes, it was found that the changes traversing all upstream nodes were introduced by this pr #7594.

change point

  1. Remove

    apisix/apisix/balancer.lua

    Lines 198 to 202 in 73618d4

    for _, node in ipairs(up_conf.nodes) do
    if core.utils.parse_ipv6(node.host) and str_byte(node.host, 1) ~= str_byte("[") then
    node.host = '[' .. node.host .. ']'
    end
    end
    from the request path, and escape it to upstream's check_schema function to implement this logic
  2. Illegal ipv6 addresses are directly rejected in the admin api
  • 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)

Note: This change is backwards compatible. When detecting data from etcd, it modifies the host for compatibility

2025/10/30 16:17:45 [warn] 2277252#2277252: *1 [lua] upstream.lua:408: checker(): PREV CONF.NODES : { {
    host = "::1",
    port = 80,
    priority = 0,
    weight = 1
  },
  <metatable> = {}
}, context: init_worker_by_lua*
2025/10/30 16:17:45 [warn] 2277252#2277252: *1 [lua] upstream.lua:414: checker(): AFTER CONF.NODES : { {
    host = "[::1]",
    port = 80,
    priority = 0,
    weight = 1
  },
  <metatable> = {}

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. performance generate flamegraph for the current PR labels Oct 30, 2025
Copy link
Member

@membphis membphis left a comment

Choose a reason for hiding this comment

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

more test cases:

call Admin API, to confirm the schema check is working right

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 30, 2025
@Revolyssup
Copy link
Contributor Author

more test cases:

call Admin API, to confirm the schema check is working right

done

membphis
membphis previously approved these changes Oct 30, 2025
nic-6443
nic-6443 previously approved these changes Oct 30, 2025
Copy link
Member

@membphis membphis left a comment

Choose a reason for hiding this comment

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

we can use a function, reuse the same code:

Image Image

anyway, it is not a big thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance generate flamegraph for the current PR size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants