Skip to content

YARN-6673 Add cpu cgroup configurations for opportunistic containers #232

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

Closed
wants to merge 2 commits into from

Conversation

szegedim
Copy link
Contributor

YARN-6673 Add cpu cgroup configurations for opportunistic containers

Copy link
Contributor

@haibchen haibchen left a comment

Choose a reason for hiding this comment

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

some minor comments, one question on cfs

@@ -72,6 +74,7 @@
static final int MIN_PERIOD_US = 1000;
@VisibleForTesting
static final int CPU_DEFAULT_WEIGHT = 1024; // set by kernel
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename CPU_DEFAULT_WEIGHT to CPU_DEFAULT_WEIGHT_GUARANTEED for clarity?

String.valueOf(cpuShares));
ContainerTokenIdentifier id = container.getContainerTokenIdentifier();
if (id != null && id.getExecutionType() ==
ExecutionType.OPPORTUNISTIC) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can have a small method for reuse I think
boolean isOpportunistic(Container container) {
ContainerTokenIdentifier id = container.getContainerTokenIdentifier();
return id !=null && id.getExecutionType() == ExecutionType.OPPORTUNISTIC;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm this is just 2 lines of code. Adding a function would be at least 5 more lines. Ideally the container has this function but that might be too much churn for the interface.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah. In some sense, it is to be more descriptive than code reuse. Maybe we could have an inline boolean variable with such name?

cGroupsHandler
.updateCGroupParam(CPU, cgroupId, CGroupsHandler.CGROUP_CPU_SHARES,
String.valueOf(cpuShares));
}
if (strictResourceUsageMode) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If strict resource usage mode is turned on, do we need to do differently for OPPORTUNISTIC containers? Now it bases the cfs_ configurations on vcore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They still have a CPU setting, right? Or is it 0?

Copy link
Contributor

Choose a reason for hiding this comment

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

They are currently based on vcore

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 a maximum setting and it still needs to be set I think. Why would opportunistic containers have more resource than guaranteed one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not quite get your question. What I meant initially was to ask you if you think base cfs-quota on vcore is the right thing to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think so. If the admin chooses strict cpu limits, all containers should get strict cpu limits based on vcores. Opportunistic ones still will be throttled by cpu.shares, if guaranteed are running. This is just a cap, for opportunistic containers with different thread counts not to affect each other negatively.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Thanks for the clarification.

ContainerId mockContainerId = mock(ContainerId.class);
when(mockContainerId.toString()).thenReturn(id);

cGroupsCpuResourceHandler.bootstrap(plugin, conf);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this above cGroupsCpuResourceHandler.prestart()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OKay.

@szegedim szegedim closed this Mar 5, 2018
shanthoosh pushed a commit to shanthoosh/hadoop that referenced this pull request Oct 15, 2019
… LocalityManager

Author: Jacob Maes <[email protected]>

Reviewers: Chris Pettitt <[email protected]>

Closes apache#232 from jmakes/samza-1346
susheelgupta7 pushed a commit to susheel-gupta/hadoop that referenced this pull request Apr 30, 2025
…Builder reports an issue with the container-executor (apache#7290) (apache#232)

Change-Id: Iaaa94c8f46faa4feaede27de36e0d94483ae0229
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