feat(nginx-conf) add a 'kong_locks' shm for resty-lock users #3550
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit introduces a new shm,
kong_locks
, to be used by instancesof lua-resty-lock across Kong or its libraries, if possible.
Since #3543 bumped the mlcache dependency, the DB cache is the first
consumer of this shm to store its locks, which helps in limiting the
effects of LRU churning in certain workloads. More components should use
this shm to store their resty-lock instances, especially instead of
relying on the
kong
shm, which is to be considered "immutable".The chosen size for this shm is 8Mb:
of any shm via configuration properties. Some additional work on top
of feat(conf) add support to configure nginx directives via kong.conf #3530 is needed for this.
about 65.000 lua-resty-lock items. While this number is very much
workload specific, it should be appropriate even in situations where
requests trigger cache misses in the runloop and the core, which
would amount for up to 10, or maybe 15 locks (with very bad luck),
which means we could still process several thousands of such cold
requests concurrently, and comfortably.
be built, in order to monitor LRU eviction on locks, or forbid them
entirely on immutable shms.
This commit is considered backwards-compatible and thus does not require
the
kong_locks
shm to be defined.