Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow limiting system resource usage #9

Closed
GrumpyBear57 opened this issue Mar 29, 2021 · 3 comments
Closed

Allow limiting system resource usage #9

GrumpyBear57 opened this issue Mar 29, 2021 · 3 comments
Assignees
Labels

Comments

@GrumpyBear57
Copy link
Member

GrumpyBear57 commented Mar 29, 2021

I'd like to be able to limit how many system resources the KT runner is allowed to consume. Something like MAX_CPU and MAX_MEM where mem accepts a percent or a unit. I also would like a system variant (MAX_SYS_CPU and MAX_SYS_MEM) that prevents the runner from starting new containers if the system wide utilization would exceed those values.
The runner should also probably default to some sane values (i.e. 50% for runner specific, and 80% for system wide)and check to ensure that there is enough to run a single container (i.e. > 5% CPU, > 500MB memory).

A network utilization limit may also be nice for other people hosting the runner on slower connections, but this is probably lower priority since the network utilization seems rather low anyways.

example:

MAX_CPU=60%
MAX_SYS_CPU=90%
MAX_MEM=50%
MAX_SYS_MEM=80%

or

MAX_MEM=8192MB
MAX_SYS_MEM=80%

or

MAX_MEM=8GB
MAX_SYS_MEM=16GB
@KentoNishi KentoNishi self-assigned this Mar 29, 2021
@KentoNishi
Copy link
Member

You can now set limits using MAX_MEM_PERCENT and MAX_CPU_PERCENT for all KT containers including the runner. It's impossible to estimate how much a container will use once started, so the limit is checked before starting. Ex. if your limit is 8GB/16GB, you would set MAX_MEM_PERCENT=50 and it will only start new containers when usage is below 50%. This means that it could theoretically go above 50% but eh 🤷

@KentoNishi
Copy link
Member

also the controller prioritizes hosts based on the relative usage, so the maximum relative load (memory or cpu) is reported to the server

@KentoNishi
Copy link
Member

Done in 9ef7bd9. you can now use

MAX_CPU=50%
MAX_MEM=4GB

or

MAX_CPU=50%
MAX_MEM=50%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants