• Kubernetes Submit Queue's avatar
    Merge pull request #66862 from resouer/sync-map · 4cca6a89
    Kubernetes Submit Queue authored
    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
    ```
    4cca6a89
Name
Last commit
Last update
..
equivalence Loading commit data...
BUILD Loading commit data...
extender.go Loading commit data...
extender_test.go Loading commit data...
generic_scheduler.go Loading commit data...
generic_scheduler_test.go Loading commit data...
scheduling_queue.go Loading commit data...
scheduling_queue_test.go Loading commit data...