diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-02 06:58:47 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-02 07:26:27 -0700 |
commit | 385aa46046ec83e6837c106576699f76e65876a7 (patch) | |
tree | b602ce89be24b9c8f2e04f18f6ccde58f2d6ae35 /lib/feature.rb | |
parent | e07ebe66af957c46e7c69329b3ab561bb539351b (diff) | |
download | gitlab-ce-385aa46046ec83e6837c106576699f76e65876a7.tar.gz |
Cache Flipper persisted names directly to local memory storagesh-cache-flipper-names-memory-cache
Now that application settings are no longer dominating network traffic,
we see that the Feature#persisted_names is using a significant amount of
CPU and network bandwidth for Redis. Move this cache into the
thread-local memory storage to reduce Redis overhead.
Diffstat (limited to 'lib/feature.rb')
-rw-r--r-- | lib/feature.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/feature.rb b/lib/feature.rb index cc9c9d44005..22420e95ea2 100644 --- a/lib/feature.rb +++ b/lib/feature.rb @@ -34,7 +34,9 @@ class Feature begin # We saw on GitLab.com, this database request was called 2300 # times/s. Let's cache it for a minute to avoid that load. - Rails.cache.fetch('flipper:persisted_names', expires_in: 1.minute) { FlipperFeature.feature_names } + Gitlab::ThreadMemoryCache.cache_backend.fetch('flipper:persisted_names', expires_in: 1.minute) do + FlipperFeature.feature_names + end end end |