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

doc for drf fair share #193

Merged
merged 6 commits into from
Jun 8, 2019
Merged

Conversation

lminzhw
Copy link
Contributor

@lminzhw lminzhw commented May 20, 2019

add doc.

@lminzhw
Copy link
Contributor Author

lminzhw commented May 20, 2019

Related: volcano-retired/scheduler#14

@k82cn
Copy link
Member

k82cn commented May 20, 2019

/cc @hex108 @jiaxuanzhou @Jeffwan

@TommyLike
Copy link
Contributor

@lminzhw why don't you add this into volcanosh/kube-batch repo?

@k82cn
Copy link
Member

k82cn commented May 20, 2019

put every discussion here. only code change in kube-batch

```go
type Session struct {
...
NamespaceInfo map[string]*kbapi.NamespaceInfo
Copy link
Member

Choose a reason for hiding this comment

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

Prefer to UserInfo, similar to other place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prefer to UserInfo, similar to other place.

Related: volcano-retired/scheduler#14 (comment)

@k82cn
Copy link
Member

k82cn commented May 20, 2019

LGTM overall, let's wait for other's feedback on that.

volcano.sh/namespace.weight: 1 <- this field represent the weight of this namespace
```

If many `ResourceQuota` in the same namespace have weight, the weight for this namespace is the highest one of them.
Copy link
Member

Choose a reason for hiding this comment

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

I don't quite understand the assumption here. Do you mean if user create several ResourceQuota in this namespace, the one with highest weight wins?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Just for corner case.

Copy link
Contributor

Choose a reason for hiding this comment

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

@lminzhw need reword these words to make it more clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

The hierarchy is Queue -> PodGroup -> Pod now. And there is no namespace now. It means that we could create pods in the same namespace for different queues. How do we deal with it?

Copy link
Member

@k82cn k82cn May 21, 2019

Choose a reason for hiding this comment

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

It means that we could create pods in the same namespace for different queues

Yes, we support that; namespace is considered as a user, so we will balance the user's resources cross queue. If there's one queue per namespace, this feature will not take effect.

/cc @lminzhw


### Cases:

- cluster have __16 cpu__, queue and namespace have default weight.
Copy link
Member

Choose a reason for hiding this comment

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

When namespace requests more resources (calculated from pods) than it's resources quota(from v1.ResourceQuota). At the same time, this namespace has higher weight than the other namespaces in the same queue? Is it a possibility some resources allocated by volcano but failed resource quota check?

Copy link
Contributor Author

@lminzhw lminzhw May 21, 2019

Choose a reason for hiding this comment

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

For this case, the request of requiring more resources than it's resources quota will cause error like this

pods \"lm-fairshare-wnchr-tb-3\" is forbidden: exceeded quota: compute-resources, requested: limits.cpu=500m, used: limits.cpu=2, limited: limits.cpu=2

So, if that pod is Pending and wait for allocation from volcano, it is already satisfied the resource quota.


So, we need a more fine-grained strategy to balance resource usage among users in the same `Queue`.

In consideration of multi-user model in kubernetes, we use namespace to distinguish different user. Each namespace would have its weight to control resources usage.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/resources/resource

spec:
hard:
limits.memory: 2Gi
volcano.sh/namespace.weight: 1 <- this field represent the weight of this namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

# this field represent the weight of this namespace
volcano.sh/namespace.weight: 1

volcano.sh/namespace.weight: 1 <- this field represent the weight of this namespace
```

If many `ResourceQuota` in the same namespace have weight, the weight for this namespace is the highest one of them.
Copy link
Contributor

Choose a reason for hiding this comment

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

@lminzhw need reword these words to make it more clear.


For namespace n1 having weight w1 and namespace n2 having weight w2, we can compute the `share` of resource and recorded as u1 and u2. Now, the resource usage of n1 less than n2 can be defined as (u1 / w1 < u2 / w2)

`e.g.` ns1 having weight w1=2 use 6cpu, ns2 having weight w2=1 use 2cpu. In the scope of cpu, the ns1 use less resource than ns2. (6 / 3 < 3 / 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

How we get this equation:

6/3 < 3/1

| q1 w1 | ns1 w3 | 5 cpu | 4 cpu | 3 cpu |
| | ns2 w1 | 10 cpu | | 1 cpu |
| q2 w3 | ns3 w2 | 10 cpu | 12 cpu | 10 cpu |
| | ns4 w6 | 2 cpu | | 2 cpu |
Copy link
Contributor

Choose a reason for hiding this comment

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

namespace4 gets more compared with namespace3 why?

Copy link
Contributor

Choose a reason for hiding this comment

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

According to the design, ns3 should have only 3 * CPU and 9 * CPU for ns4, i think.

volcano.sh/namespace.weight: 1 <- this field represent the weight of this namespace
```

If many `ResourceQuota` in the same namespace have weight, the weight for this namespace is the highest one of them.
Copy link
Contributor

Choose a reason for hiding this comment

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

The hierarchy is Queue -> PodGroup -> Pod now. And there is no namespace now. It means that we could create pods in the same namespace for different queues. How do we deal with it?

apiVersion: v1
kind: ResourceQuota
metadata:
namespace: default
Copy link
Contributor

Choose a reason for hiding this comment

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

Is ResourceQuota same as Kubernetes ResourceQuota? If not, could volcano.sh/namespace.weight be named to weight because the whole type is volcano.sh related?

Does it need a name? Then we could create different quotas of same namespace for different queues.

Copy link
Member

Choose a reason for hiding this comment

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

it's Kubernetes ResourceQuota as far as I known :)

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is same, it is a little inappropriate to put volcano.sh/namespace.weight in .spec.hard, because hard is the set of desired hard limits for each named resource and weight is not a hard limit.

Copy link
Member

Choose a reason for hiding this comment

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

hard is the set of desired hard limits for each named resource and weight is not a hard limit.

It's a kind of hard as scheduler will make sure namespace will not be overused.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is OK if it is a hard limit.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is OK if it is a hard limit.

And once the resource reached the limit, there will be no more pods created for the namespace.

@k82cn
Copy link
Member

k82cn commented May 27, 2019

LGTM overall 👍 , let's wait for other comments :)

@k82cn
Copy link
Member

k82cn commented Jun 8, 2019

/lgtm
/approve

@volcano-sh-bot volcano-sh-bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Jun 8, 2019
@volcano-sh-bot volcano-sh-bot merged commit e261e87 into volcano-sh:master Jun 8, 2019
@k82cn
Copy link
Member

k82cn commented Jun 8, 2019

Get it merged firstly; let's open other PRs if any enhancements.

kevin-wangzefeng pushed a commit to kevin-wangzefeng/volcano that referenced this pull request Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants