Skip to content

Commit d7ad00e

Browse files
szachovyCopilot
andcommitted
Configure Redis memory limit and eviction policy
Create redis.conf with maxmemory=512mb and allkeys-lru eviction. Mount into Redis container and start with redis-server /etc/redis/redis.conf. Prevents Redis OOM from SQL Lab query spikes killing the Celery broker. Closes #78 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0ab8ce7 commit d7ad00e

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
* Dependabot updates for `github-actions` and `terraform` ecosystems. (#29)
1616
* CI workflow to build and push service images to GitHub Container Registry on master merge. (#97)
1717
* Pull-first with local build fallback for container images during deployment. (#97)
18+
* Redis memory limit (512MB) and LRU eviction policy via redis.conf. (#78)
1819

1920
### Changed
2021

services/superset/redis.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
maxmemory 512mb
2+
maxmemory-policy allkeys-lru
3+
tcp-backlog 511
4+
timeout 300

src/container.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,18 @@ def run(self) -> None:
394394
self.create_network()
395395
self.client.containers.run(
396396
"redis",
397+
command=["redis-server", "/etc/redis/redis.conf"],
397398
detach=True,
398399
restart_policy={"Name": "always"},
399400
name="redis",
400401
hostname="redis",
401402
network="superset-network",
403+
volumes={
404+
"/opt/superset-cluster/superset/redis.conf": {
405+
"bind": "/etc/redis/redis.conf",
406+
"mode": "ro"
407+
}
408+
},
402409
healthcheck={
403410
'test': ["CMD", "redis-cli", "ping"],
404411
'interval': self.healthcheck_interval * 1000000000,

0 commit comments

Comments
 (0)