You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(declarative) lazy load full schema for validation and store it in partial schema
### Summary
It was reported on Kong#6547 that each time a new configuration is loaded to Kong the
memory is leaked. On the issue thread there are information of the where the leak
starts and where the actual leak happens.
See: Kong#6547 (comment)
and: Kong#6547 (comment)
This PR changes the code so that we only (lazy) load the `full schema` that is needed
for `full validation` only once and then we store that into partial schema. This means
that we are not constantly re-creating the fullschema that seems to be cached
differently inside `schema.lua` on each invocation as it uses tables as cache keys
and the load seem to make new tables for fields each time we call `Declarative.load`.
I am not 100% sure does it remove the leaks fully but here is a test that I did manually:
#### Numbers without Patch
Worker memory usage when started with example `kong.yaml`:
110 MB
Worker memory usage after making 100 config updates to `:8001/config`:
714 MB
#### Numbers with Patch (this commit)
110 MB (when started)
237 MB (after 100 updates)
### Issues Resolved
FixKong#6547
0 commit comments