• Stan Hu's avatar
    Enable Redis cache key compression · 8c717504
    Stan Hu authored
    We have a number of keys that are over 1 MB that would be compressed
    significantly (over 90%) if this feature were enabled. We had this
    disabled by default to ensure backwards compatibility with the previous
    Redis store.
    
    We should enable it now because compression significantly reduces the
    pressure on the Redis server. Every time a large payload is stored in
    Redis, Redis may need to evict many small keys to make room.
    
    This adds a little more CPU overhead on the application workers, which
    is why we have an environment variable
    (`ENABLE_REDIS_CACHE_COMPRESSION`) to turn if off it it becomes a
    problem.
    
    Behind the scenes, Rails implements this by serializing a `compressed`
    variable with the `ActiveSupport::Cache::Entry` if the payload size
    exceeds the compression threshold (4K by default). When the entry is
    deserialized from Redis, if the `compressed` boolean is set, the value
    will be decompressed. Thus even in a mixed-deployment where this setting
    is not on by default, Rails will be able to decode compressed values
    just fine.
    
    Closes https://gitlab.com/gitlab-org/gitlab/issues/198586
    8c717504
application.rb 13.4 KB