Commit Graph

53 Commits (664d79724554e8a3b660ec33eabd23f16fbd7765)

Author SHA1 Message Date
Wei Huang 9da576f03c
move SchedulingQueue to pkg/scheduler/internal/queue 2018-09-28 11:51:02 -07:00
k8s-ci-robot a6bc5aa49e
Merge pull request #68563 from DylanBLE/dev
fix scheduler crash when Prioritize Map function failed
2018-09-26 22:59:04 -07:00
Bobby (Babak) Salamat f340f8baf8 Remove PDB and its event handlers from the scheduler cache 2018-09-26 14:22:21 -07:00
hongjian.sun f33c2c11f2 fix scheduler crash when Prioritize Map function failed 2018-09-26 20:16:05 +08:00
Yecheng Fu 2f46bc8a18 Use seqeuence number to represent generation of equivalence cache.
- snapshot equivalence cache generation numbers before snapshotting the
scheduler cache
- skip update when generation does not match live generation
- keep the node and increment its generation to invalidate it instead of
deletion
- use predicates order ID as key to improve performance
2018-09-22 12:08:21 +08:00
Guoliang Wang 6c63dcfffe Not split nodes when searching for nodes but doing it all at once 2018-09-04 14:07:24 +08:00
Bobby (Babak) Salamat abb70aee98 Add a scheduler config argument to set the percentage of nodes to score 2018-08-17 11:18:51 -07:00
Chao Wang 895b6d441d add space for output 2018-08-01 18:08:31 +08:00
Harry Zhang d644162a29 Extender preemption should respect IsInterested()
Co-authored-by: Harry Zhang <resouer@gmail.com>
Co-authored-by: Chun Chen <ramichen@tencent.com>
2018-07-23 10:13:38 +08:00
Harry Zhang e5a7a4caf7 Fist level ecache for nodeMap
Use new cache map in scheduler

Add a integration test

Move init before schedudling

Add lock for first level cache
2018-07-18 15:11:59 +08:00
tanshanshan 06fb64cdf8 fix glogformat 2018-07-14 10:22:12 +08:00
Kubernetes Submit Queue f0311d8232
Merge pull request #65396 from bsalamat/sched_no_sort
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Improve scheduler's performance by eliminating sorting of nodes by their score

**What this PR does / why we need it**:
Profiling scheduler, I noticed that scheduler spends a significant amount of time in sorting the nodes after we score them to find nodes with the highest score. Finding nodes with the highest score does not need sorting the array. This PR replaces the sort with a linear scan.

Eliminating the sort results in over 10% improvement in throughput of the scheduler.

Before (3 runs for 5000 nodes, scheduling 1000 pods in a cluster running 2000 pods):
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  20682552 ns/op
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  20464729 ns/op
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  21188906 ns/op

After:
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  18485866 ns/op
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  18457749 ns/op
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  18418200 ns/op

**Release note**:

```release-note
Improve scheduler's performance by eliminating sorting of nodes by their score.
```
2018-06-23 20:12:01 -07:00
Bobby (Babak) Salamat ffc8cc2f50 Improve scheduler's performance by eliminating sorting when finding the host with the highest score 2018-06-23 11:24:43 -07:00
Bobby (Babak) Salamat fab26e470c Add more unresolvable conditions to optimize preemption logic 2018-06-22 17:04:55 -07:00
Shyam Jeedigunta b9ae20c99e Split scheduler latency metric to fine-grained steps 2018-06-21 14:19:39 +02:00
Jonathan Basseri b571065bc4 Clean up names in equivalence package.
Remove stutter from names and provide more idiomatic patterns.

This makes call sites that use equivalence cache easier to read.
2018-06-20 10:52:33 -07:00
Jonathan Basseri 31c746d960 Move equivalence cache into new package.
This moves the equivalence cache implementation out of the 'core'
package and into k8s.io/kubernetes/pkg/scheduler/core/equivalence.

Separating the equiv. cache from the genericScheduler implementation
make their interaction points easier to follow, and prevents us from
accidentally accessing unexported fields.
2018-06-20 10:52:32 -07:00
Kubernetes Submit Queue dd040d6010
Merge pull request #63942 from misterikkit/ecache-cleanup
Automatic merge from submit-queue (batch tested with PRs 64142, 64426, 62910, 63942, 64548). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

scheduler: further cleanup of equivalence cache

**What this PR does / why we need it**:
This improves comments and simplifies some names/logic in equivalence_cache.go, as well as changing the order of some items in the file.


**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
/kind cleanup
2018-06-20 00:05:18 -07:00
Kubernetes Submit Queue 53d03c58cd
Merge pull request #64179 from wgliang/master.scheduler-unused-para
Automatic merge from submit-queue (batch tested with PRs 64252, 64307, 64163, 64378, 64179). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove unused parameter (pod) in `pkg/scheduler/core/generic_scheduler`

**What this PR does / why we need it**:

Remove unused parameter (pod) in `pkg/scheduler/core/generic_scheduler`

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-19 21:45:21 -07:00
Guoliang Wang 761cf41427 Move pkg/scheduler/schedulercache -> pkg/scheduler/cache 2018-05-31 22:55:34 +08:00
Jonathan Basseri 9b06870620 Clean up names and comments in equivalence cache. 2018-05-29 11:22:02 -07:00
Guoliang Wang 097094e5fa Remove unused parameter (pod) 2018-05-23 13:56:17 +08:00
Jonathan Basseri 55662f26f1 Simplify logic in podFitsOnNode.
Use new (*EquivalenceCache).RunPredicate to simplify how we read and
update the equivalence cache items.
2018-04-27 15:55:10 -07:00
Jonathan Basseri e67b3225a4 Remove predicateResults map from podFitsOnNode.
The purpose of this map is to combine two predicate results before
writing to the equivalence cache. However, the branch that combines
results is unreachable.

1. Combining results happens in the second iteration of the outer loop.
2. There is only a second iteration when podsAdded is true.
3. We skip equiv. cache when podsAdded is true.
2018-04-27 15:55:10 -07:00
Da K. Ma 2c10d15ae5 Do not schedule pod to the node under PID pressure.
Signed-off-by: Da K. Ma <klaus1982.cn@gmail.com>
2018-04-26 10:07:42 +08:00
Jonathan Basseri dacc1a8d52 Check for old NodeInfo when updating equiv. cache.
Because the scheduler takes a snapshot of cache data at the start of
each scheduling cycle, updates to the equivalence cache should be
skipped if there was a cache update during the cycle.

If the current NodeInfo becomes stale while we evaluate predicates, we
will not write any results into the equivalence cache. We will still use
the results for the current scheduling cycle, though.
2018-04-25 10:18:40 -07:00
Harry Zhang 4f0bd4121e Disable pod preemption by config 2018-04-12 21:11:51 -07:00
Harry Zhang 083684d771 Add test to verify preempt ignore 2018-04-04 16:28:15 -07:00
Harry Zhang 7f04129736 Add Ignorable flag to extender
Ignore extender in generic scheduler

Add test to verify the ignorable flag

Fix warning msg
2018-03-30 15:10:31 -07:00
Harry Zhang 202c6b68ee Use inclien func to ensure unlock is executed 2018-03-25 11:54:16 -07:00
Bobby (Babak) Salamat 4386751b5d
Revert "Revert revert of equivalence class hash calculation in scheduler" 2018-03-23 17:34:49 -07:00
Kubernetes Submit Queue 9a3b0bd74f
Merge pull request #60753 from resouer/equiv-hash
Automatic merge from submit-queue (batch tested with PRs 60898, 60912, 60753, 61002, 60796). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Revert revert of equivalence class hash calculation in scheduler

**What this PR does / why we need it**:

NOTE: This is a revert revert of https://github.com/kubernetes/kubernetes/pull/58555

But since the original PR has been changed, I have to copy the original changes and resend this new PR. See: https://github.com/kubernetes/kubernetes/pull/58555#issuecomment-364345972

And I kept @misterikkit 's change as the first commit (by co-author feature of github) in the history. 

We decide to do revert revert because #58989 has been fixed, which should help to improve the time consumed by integration test.

**But** we should still pay attention to integration tests to see if there's frequent timeout happen.

**Special notes for your reviewer**:

**Release note**:

```release-note
Improve equivalence class hash calculation in scheduler
```
2018-03-20 17:37:14 -07:00
Harry Zhang 5cc841a337 Use inline func to fix deadlock 2018-03-09 10:57:03 -08:00
Harry Zhang b62d82422d Fix golints in extender 2018-03-02 17:12:02 -08:00
Harry Zhang 71603f2f85 Add preemption in scheduler extender
Add verb and preemption for scheduler extender

Update bazel

Use simple preemption in extender

Use node name instead of v1.Node

Fix support method

Fix preemption dup

Remove uneeded logics

Remove nodeInfo from param to extender

Update bazel for scheduler types

Mock extender cache with nodeInfo

Add nodeInfo as extender cache

Choose node name or node based on cache flag

Always return meta victims in result
2018-03-02 17:12:02 -08:00
Shijun Qin 158257473a
Fix a grammatical error in a comment
Fix a grammatical error in a comment in scheduler's code. We should use a word's plural form after "one of".
2018-03-02 21:30:44 +08:00
Yang Guo 8d880506fe Support cluster-level extended resources in kubelet and kube-scheduler
Co-authored-by: Yang Guo <ygg@google.com>
Co-authored-by: Chun Chen <chenchun.feed@gmail.com>
2018-02-27 17:25:30 -08:00
Kubernetes Submit Queue 49a1478839
Merge pull request #60263 from tossmilestone/reuse-minNodes
Automatic merge from submit-queue (batch tested with PRs 60106, 59510, 60263, 60063, 59088). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Reuse the `min*Nodes` slices in order to save GC time

**What this PR does / why we need it**:
Reuse the `min*Nodes` slices to save GC time when executing `pickOneNodeForPreemption`.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #59748

**Special notes for your reviewer**:

**Release note**:

```release-note
None
```
2018-02-23 02:59:47 -08:00
tossmilestone 5a083f2038 Reuse the "min*Nodes" slices to save the GC time. 2018-02-23 14:16:19 +08:00
Kubernetes Submit Queue 01bd3c4b74
Merge pull request #59734 from mlmhl/format_imports
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Format some import statements in scheduler pkg

**What this PR does / why we need it**:

As the title says, apply `goimports` on some files under `pkg/scheduler` pkg.

**Release note**:

```release-note
NONE
```
2018-02-13 08:04:15 -08:00
Kubernetes Submit Queue ab2e1cb02a
Merge pull request #59479 from tossmilestone/avoid-ecahe-update-race
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Avoid race condition when updating equivalence cache

**What this PR does / why we need it**:
Lock the ecache to update the ecache on each predicate running, to avoid race condition.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fix #58507 

**Special notes for your reviewer**:
None

**Release note**:

```release-note
None
```
2018-02-12 16:38:07 -08:00
mlmhl b3fff71161 format some import statements in scheduler pkg 2018-02-12 09:04:00 +08:00
tossmilestone e155582662 Avoid race condition when updating equivalence cache. 2018-02-09 16:26:41 +08:00
tossmilestone 3fdacfead5 Fix golint errors in `pkg/scheduler` based on golint check 2018-02-08 15:22:47 +08:00
Kubernetes Submit Queue 5a4b160cf0
Merge pull request #59281 from bsalamat/nominated_node
Automatic merge from submit-queue (batch tested with PRs 59010, 59212, 59281, 59014, 59297). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Replace nominateNodeName annotation with PodStatus.NominatedNodeName

**What this PR does / why we need it**:
Replaces nominateNodeName annotation with PodStatus.NominatedNodeName in scheudler's logic. We don't expect any logic/behavior changes.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

ref #57471

/sig scheduling
cc: @k82cn @aveshagarwal @resouer
2018-02-07 15:27:43 -08:00
Harry Zhang 482dc31937 Ensure euqiv hash calculation per schedule 2018-02-06 14:42:39 -08:00
Bobby (Babak) Salamat bfd950e471 Replace nominateNodeName annotation with PodStatus.NominatedNodeName in scheudler logic 2018-02-02 13:06:33 -08:00
Bobby (Babak) Salamat 2274e93b64
Revert "Change equivalence class hashing function" 2018-01-26 18:13:15 -08:00
Jonathan Basseri 466a499fcb Move equivalence class hash code.
This moves the equivalence hashing code from
algorithm/predicates/utils.go to core/equivalence_cache.go.

In the process, making the hashing function and hashing function factory
both injectable dependencies is removed.
2018-01-24 17:15:42 -08:00
junxu 5deb5f4913 Rename func name according TODO 2018-01-15 00:08:59 -05:00