Skip to content

feat: add config option to run redis server inside mem-constrained cgroup#127

Open
dariusgrassi wants to merge 4 commits intoldos-project:mainfrom
dariusgrassi:redis-constrained
Open

feat: add config option to run redis server inside mem-constrained cgroup#127
dariusgrassi wants to merge 4 commits intoldos-project:mainfrom
dariusgrassi:redis-constrained

Conversation

@dariusgrassi
Copy link
Copy Markdown
Contributor

@dariusgrassi dariusgrassi commented May 3, 2025

Add something similar to

mem_cgroup_name: "redis_mem"
mem_cgroup_size: "1G"

to your config for Redis to constrain the memory available to the Redis server

this PR also allows redis benchmarks to complete with the collector on when memory constrained

@dariusgrassi dariusgrassi requested a review from a team as a code owner May 3, 2025 21:56
Copy link
Copy Markdown
Collaborator

@tewaro tewaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make these small changes, let's go from there.

Comment thread python/kernmlops/kernmlops_benchmark/redis.py Outdated
Comment thread python/kernmlops/kernmlops_benchmark/redis.py Outdated
Comment thread Makefile
${CONTAINER_CPUSET} \
--pid=host \
--privileged \
--cgroupns=host \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default the docker namespace is restricted from managing cgroups internally. this flag grants the container the necessary permissions for host cgroup management.

https://www.whexy.com/posts/cgroup-inside-containers

Comment on lines +106 to +107
with open(f"{cgroup_path}/cgroup.procs", "w") as f:
f.write(str(os.getpid()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you be able to do this with a launching pre_exec function in subprocess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants