Skip to content

Cleanup cached predicates #3609

@szuecs

Description

@szuecs

In #3600 we introduced a cache to speedup the matching in Jwt predicates.
In the implementation we clear all the values in the cache but we hold a reference to the predicates created and never clean these up creating a memory leak. In high frequent route changing environments this could potentially being visible in memory graphs.

ref discussion https://github.com/zalando/skipper/pull/3600/files#r2313466897

In order to fix this I propose to use eskip.Predicate as another part of the cache key, such that the same 2 tuple of predicate and header string would lookup the same cached result.
Interestingly we could also use a single cache for all routes, but I am not sure if this creates a little lock contention, and normally I would rather have more memory in use than possible more lock wait in hot path like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions