Skip to content

perf: don't cache all request headers on critical code path#7287

Merged
spacewander merged 4 commits into
apache:masterfrom
soulbird:fix/perf_forwarded_proto
Jun 22, 2022
Merged

perf: don't cache all request headers on critical code path#7287
spacewander merged 4 commits into
apache:masterfrom
soulbird:fix/perf_forwarded_proto

Conversation

@soulbird

@soulbird soulbird commented Jun 21, 2022

Copy link
Copy Markdown
Contributor

Description

1、core.request.header will get all request headers and cache these, we don't need to do this on critical code paths.
2、We can use api_ctx.var.http_x_forwarded_proto to get only one header we need

Fixes #7258

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)

@soulbird
soulbird marked this pull request as ready for review June 21, 2022 09:59
@spacewander
spacewander merged commit f6cdc79 into apache:master Jun 22, 2022
soulbird added a commit to soulbird/apisix that referenced this pull request Jun 24, 2022
nic-chen pushed a commit to nic-chen/apisix that referenced this pull request Jun 25, 2022
nic-chen pushed a commit to nic-chen/apisix that referenced this pull request Jun 25, 2022
spacewander pushed a commit that referenced this pull request Jun 26, 2022
* fix: duplicate X-Forwarded-Proto will be sent as string (#7229)

Co-authored-by: soulbird <[email protected]>

* perf: don't cache all request headers on critical code path (#7287)

Co-authored-by: soulbird <[email protected]>
spacewander pushed a commit that referenced this pull request Jun 27, 2022
…ream as string (#7326)

* fix: duplicate X-Forwarded-Proto will be sent as string (#7229)

Co-authored-by: soulbird <[email protected]>

* perf: don't cache all request headers on critical code path (#7287)

Co-authored-by: soulbird <[email protected]>
Co-authored-by: soulbird <[email protected]>
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.

bug: read header may cause an abnormally high CPU

3 participants