Rewrites regex compilation heap allocation and CPU time is high
Looking at the profiler for CPU time, heap size and heap allocations for redirects.Rewrite
. We can see that the call to regexp.Compile
has a high performance effect on the redirects feature.
CPU Time for 1 day before the FF_ENABLE_PLACEHOLDERS
feature flag was enabled.
After
Heap size before
Heap size after
Allocated heap before
After
The increase is quite significant but the good news is we will only come here if:
- The resource being accessed does not exist, and
- The project has a
_redirects
file, and - A simple redirect rule does not match first, and
- A splat/placeholder rule exists.
The increase seen above is probably due to docs.gitlab.com having enabled splats for all resources under /ce/*
to redirect to /ee/:splat
in gitlab-docs!2094 (merged).
So this is not a dealbreaker in my opinion, but it's certainly something to keep an eye on.
Edited by Jaime Martinez