diff --git a/docker-compose.yml b/docker-compose.yml index 9e4ae9dd730..b11db2d79aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -110,6 +110,10 @@ services: test: redis-cli ping | grep PONG volumes: - "sentry-redis:/data" + - type: bind + read_only: true + source: ./redis.conf + target: /usr/local/etc/redis/redis.conf ulimits: nofile: soft: 10032 diff --git a/redis.conf b/redis.conf new file mode 100644 index 00000000000..25103a88119 --- /dev/null +++ b/redis.conf @@ -0,0 +1,26 @@ +# redis.conf + +# The 'maxmemory' directive controls the maximum amount of memory Redis is allowed to use. +# Setting 'maxmemory 0' means there is no limit on memory usage, allowing Redis to use as much +# memory as the operating system allows. This is suitable for environments where memory +# constraints are not a concern. +# +# Alternatively, you can specify a limit, such as 'maxmemory 15gb', to restrict Redis to +# using a maximum of 15 gigabytes of memory. +# +# Example: +# maxmemory 0 # Unlimited memory usage +# maxmemory 15gb # Limit memory usage to 15 GB + +maxmemory 0 + +# maxmemory-policy allkeys-lru +# +# This setting determines how Redis evicts keys when it reaches the memory limit. +# 'allkeys-lru' evicts the least recently used keys from all keys stored in Redis, +# allowing frequently accessed data to remain in memory while older data is removed. +# +# Example: +# maxmemory-policy allkeys-lru # Use LRU eviction for all keys + +maxmemory-policy allkeys-lru