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

DIS-1449 add resource limits to executor config and spawn opts #491

Merged
merged 8 commits into from
Dec 19, 2023

Conversation

pretentious7
Copy link
Contributor

No description provided.

@pretentious7 pretentious7 marked this pull request as ready for review December 15, 2023 20:45
@pretentious7 pretentious7 force-pushed the abhi/add-resource-limits branch from e99937a to e702a2e Compare December 18, 2023 19:32
Copy link
Member

@paulgb paulgb left a comment

Choose a reason for hiding this comment

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

Looks good! A couple minor comments.

.resource_limits
.cpu_time_limit
.map(|cpu_time_limit| {
let mins = (cpu_time_limit.as_secs_f64() / 60.0).floor() as i64;
Copy link
Member

Choose a reason for hiding this comment

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

where does mins come from as the unit? From the man page for ulimit it looks like CPU time is secs, but I can't find anything that talks about if/how docker transforms it https://ss64.com/bash/ulimit.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pulled that from the earlier code I think, but it was wrong

image

thanks for the catch.

Comment on lines +140 to +144
cpu_period: exec_config
.resource_limits
.cpu_period
.as_ref()
.map(|cpu_period| std::time::Duration::from(cpu_period).as_micros() as i64),
Copy link
Member

Choose a reason for hiding this comment

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

Do you know what happens if cpu_quota is Some(_) but cpu_period is None?

If Docker ignores it, I would rather that we use the default period so that someone who supplies cpu_quota gets the behavior they expect.

I am assuming that cpu_period has no effect if cpu_quota is not provided (I can't find confirmation in the docker docs). If that's not the case, we probably want to use the default only if cpu_quota is provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question

after doing

docker run --cpu-quota=10000 -it --rm bash

I get:

image

so yea it just uses the default, but in anticipation of surprising behaviour I agree we should just pass in the default anyhow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, probably less surprising if we just leave it

Copy link
Member

Choose a reason for hiding this comment

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

I agree with leaving the default behaviour to Docker. Since it uses the Docker default if it is None, can we get rid of DockerCpuPeriod::default and use None instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is what it's doing now. Or do you mean get rid of the default impl? I use that to calculate quota from the relative value if the period isn't specified.

Copy link
Member

Choose a reason for hiding this comment

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

ahh right, nevermind

@pretentious7 pretentious7 force-pushed the abhi/add-resource-limits branch from abaf210 to a74abdd Compare December 18, 2023 21:51
@pretentious7 pretentious7 requested a review from paulgb December 18, 2023 22:22
@pretentious7 pretentious7 force-pushed the abhi/add-resource-limits branch from f40f45c to b9c6759 Compare December 19, 2023 17:15
@pretentious7 pretentious7 changed the title add resource limits to executor config and spawn opts DIS-1449 add resource limits to executor config and spawn opts Dec 19, 2023
Copy link
Member

@paulgb paulgb left a comment

Choose a reason for hiding this comment

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

LGTM!

@pretentious7 pretentious7 merged commit bbe0d62 into plane2-preview Dec 19, 2023
4 checks passed
@pretentious7 pretentious7 deleted the abhi/add-resource-limits branch December 19, 2023 18:51
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