Avoiding Scheduler Subversion usin ing Scheduler-Cooperative Locks
Yuvraj Patel, Leon Yang*, Leo Arulraj+, Andrea C. Arpaci-Dusseau, Remzi H. Arpaci-Dusseau, Michael M. Swift University of Wisconsin-Madison
* - Now at Facebook, + - Now at Cohesity
Avoiding Scheduler Subversion usin ing Scheduler-Cooperative Locks - - PowerPoint PPT Presentation
Avoiding Scheduler Subversion usin ing Scheduler-Cooperative Locks Yuvraj Patel, Leon Yang * , Leo Arulraj + , Andrea C. Arpaci-Dusseau, Remzi H. Arpaci-Dusseau, Michael M. Swift University of Wisconsin-Madison * - Now at Facebook, + - Now at
* - Now at Facebook, + - Now at Cohesity
2
App 1 Bins/Lib
Container Engine Operating System Physical Infrastructure
App 2 Bins/Lib App 1 Bins/Lib
Hypervisor Physical Infrastructure
App 2 Bins/Lib Guest OS Guest OS
Example use-cases of modern data centers
Containers VM1 VM2
Clients
C2 C1
3
twice as long as P1
acquisition fairness
Expected
4
twice as long as P1
acquisition fairness
Expected Observed CPU allocation aligns with lock usage
cases
5
6
7
8
9
10
11
12
13
Put/Get Insert/Find
LevelDB UpScaleDB Ratio of median critical section times for various systems
14
1. Lock–Unlock: Is That All? A Pragmatic Analysis of Locking in Software Systems. ACM Trans. Comput. Syst.,36(1), March 2019 2. Remote Core Locking: Migrating Critical-Section Execution to Improve the Performance of Multithreaded Applications. USENIX ATC 2012 3. Understanding Manycore Scalability of File Systems, USENIX ATC 2016 4. Non-scalable locks are dangerous. Linux Symposium, 2012
15
16
17
18
scl_lock() { ….. lock.start_cs = now() } scl_unlock() { ….. end_cs = now() cs_time = end_cs – lock.start_cs ….. }
19
scl_lock() { ….. lock.start_cs = now() } scl_unlock() { ….. end_cs = now() cs_time = end_cs – lock.start_cs ….. }
20
scl_lock() { ….. lock.start_cs = now() } scl_unlock() { ….. end_cs = now() cs_time = end_cs – lock.start_cs ….. }
21
22
scl_lock() { if (penalty) { sleep-until-penalty-time } ….. lock.start_cs = now() } scl_unlock() { ….. end_cs = now() cs_time = end_cs – lock.start_cs calculate penalty, penalty-time ….. }
23
scl_lock() { if (penalty) { sleep-until-penalty-time } ….. lock.start_cs = now() } scl_unlock() { ….. end_cs = now() cs_time = end_cs – lock.start_cs calculate penalty, penalty-time ….. }
24
25
P0 P1
26
P0 P1 Lock slice (2ms) Time
27
P0 P1 Lock slice (2ms) Time
28
P0 P1 Lock slice (2ms) Lock slice (2ms) Time
29
P0 P1 Lock slice (2ms) Lock slice (2ms) Time
30
P0 P1 Lock slice (2ms) Lock slice (2ms) Lock slice (2ms) Time
31
P0 P1 Lock slice (2ms) Lock slice (2ms) Lock slice (2ms) Time
32
33
34
Workload – 8 threads (4 insert threads + 4 find threads) pinned on 4 CPU, equal CPU allocation
TPUT - 22.2K Mutex TPUT - 11.7K
35
Workload – 8 threads (4 insert threads + 4 find threads) pinned on 4 CPU, equal CPU allocation
TPUT - 22.2K TPUT - 695K Mutex u-SCL TPUT - 11.7K
36
Workload – 8 threads (4 insert threads + 4 find threads) pinned on 4 CPU, equal CPU allocation
TPUT - 22.2K TPUT - 35K TPUT - 695K Mutex u-SCL TPUT - 11.7K
37
Workload – 8 threads (4 insert threads + 4 find threads) pinned on 4 CPU, equal CPU allocation
Max Lock Hold Time TPUT - 22.2K TPUT - 35K TPUT - 695K Mutex u-SCL TPUT - 11.7K
38
39
40
41