Skip to content

Commit

Permalink
perf(router): unify cache key and context generation in expressions r…
Browse files Browse the repository at this point in the history
…outer (#12127)

Cache key and context generation are closely related on field present inside configured expressions.

It is advantageous to unify the logic for generating them to:

1. Improve cache hit rate, so that only fields referenced inside expressions participates in cache
key generation. This is particularly important since we plan on adding more match fields into
expressions in the future
2. Improve performance, allows field value to be cached and reused between cache key and context generation
3. Reduced code duplication

KAG-3032
  • Loading branch information
chronolaw authored and ADD-SP committed Mar 7, 2024
1 parent b4346ce commit aa544b8
Show file tree
Hide file tree
Showing 6 changed files with 486 additions and 321 deletions.
14 changes: 8 additions & 6 deletions kong-3.4.3-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ build = {
["kong.cache"] = "kong/cache/init.lua",
["kong.cache.warmup"] = "kong/cache/warmup.lua",
["kong.global"] = "kong/global.lua",
["kong.router"] = "kong/router/init.lua",
["kong.router.traditional"] = "kong/router/traditional.lua",
["kong.router.compat"] = "kong/router/compat.lua",
["kong.router.expressions"] = "kong/router/expressions.lua",
["kong.router.atc"] = "kong/router/atc.lua",
["kong.router.utils"] = "kong/router/utils.lua",
["kong.reports"] = "kong/reports.lua",
["kong.constants"] = "kong/constants.lua",
["kong.concurrency"] = "kong/concurrency.lua",
Expand All @@ -64,6 +58,14 @@ build = {
["kong.error_handlers"] = "kong/error_handlers.lua",
["kong.hooks"] = "kong/hooks.lua",

["kong.router"] = "kong/router/init.lua",
["kong.router.traditional"] = "kong/router/traditional.lua",
["kong.router.compat"] = "kong/router/compat.lua",
["kong.router.expressions"] = "kong/router/expressions.lua",
["kong.router.atc"] = "kong/router/atc.lua",
["kong.router.fields"] = "kong/router/fields.lua",
["kong.router.utils"] = "kong/router/utils.lua",

["kong.conf_loader"] = "kong/conf_loader/init.lua",
["kong.conf_loader.listeners"] = "kong/conf_loader/listeners.lua",

Expand Down
Loading

0 comments on commit aa544b8

Please sign in to comment.