k3s/pkg/scheduler
Kubernetes Submit Queue 4cca6a89a0
Merge pull request #66862 from resouer/sync-map
Automatic merge from submit-queue (batch tested with PRs 66862, 67618). 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>.

Use sync.map to scale equiv class cache better

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

Change the current lock in first level ecache into  `sync.Map`, which is known for scaling better than `sync. Mutex ` on machines with >8 CPUs

ref: https://golang.org/pkg/sync/#Map
 
And the code is much cleaner in this way.

5k Nodes, 10k Pods benchmark with ecache enabled in 64 cores VM:

```bash
// before
BenchmarkScheduling/5000Nodes/0Pods-64             10000          17550089 ns/op

// after
BenchmarkScheduling/5000Nodes/0Pods-64             10000          16975098 ns/op
```
Comparing to current implementation, the improvement after this change is noticeable, and the test is stable in 8, 16, 64 cores VM.

**Special notes for your reviewer**:

**Release note**:

```release-note
Use sync.map to scale ecache better
```
2018-08-21 00:24:01 -07:00
..
algorithm using set instead of lists for topologyPairsMaps attributes 2018-08-18 01:02:48 +02:00
algorithmprovider Add a scheduler config argument to set the percentage of nodes to score 2018-08-17 11:18:51 -07:00
api Add a scheduler config argument to set the percentage of nodes to score 2018-08-17 11:18:51 -07:00
cache Autogenerated files 2018-08-17 11:18:52 -07:00
core Merge pull request #66862 from resouer/sync-map 2018-08-21 00:24:01 -07:00
factory Add a scheduler config argument to set the percentage of nodes to score 2018-08-17 11:18:51 -07:00
metrics Add metrics to equivalence cache. 2018-08-15 15:51:13 -07:00
testing Add NodeTree to the scheduler cache 2018-08-17 09:56:51 -07:00
util Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
volumebinder Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
BUILD Autogenerated files 2018-08-17 11:18:52 -07:00
OWNERS Update OWNERS labels for cluster-lifecycle and scheduling 2018-04-05 16:25:04 -05:00
scheduler.go Delete dead code in pkg/scheduler. 2018-08-15 17:14:38 -07:00
scheduler_test.go Add a scheduler config argument to set the percentage of nodes to score 2018-08-17 11:18:51 -07:00
testutil.go Delete dead code in pkg/scheduler. 2018-08-15 17:14:38 -07:00