Job Executor

Download Report

Transcript Job Executor

Task Scheduling for Highly Concurrent
Analytical and Transactional
Main-Memory Workloads
Iraklis Psaroudakis (EPFL), Tobias Scheuer (SAP AG), Norman
May (SAP AG), Anastasia Ailamaki (EPFL)
1
Scheduling for high concurrency
Queries >> H/W contexts
Limited number
of H/W contexts
How should the DBMS use available CPU resources?
2
Scheduling for mixed workloads
OLTP
OLAP
Short-lived
Reads & updates
Scan-light
Long-running
Read-only
Scan-heavy
Single thread
Parallelism
Contention in highly
concurrent situations
How to schedule highly concurrent mixed workloads?
3
Scheduling tactics
• OS scheduler
Context switch
Cache thrashing
Overutilization
1
2
11
1
11
2 2
3
3
2
33
22
Time TimeTime
• Admission control
# Threads
Coarse granularity of control
} overutilization
# H/W contexts
} underutilization
Time
We need to avoid both underutilization and overutilization
4
Task scheduling
run() {
...
}
• A task can contain any code
• One worker thread per core processing tasks
Task queues
Socket 1
Socket 2
• Distributed queues to minimize sync contention
• Task stealing to fix imbalance
• OLAP queries can parallelize w/o overutilization
Provides a solution to efficiently utilize CPU resources
5
Task scheduling problems for DBMS
• OLTP tasks can block
– Problem: under-utilization of CPU resources
– Solution: flexible concurrency level
• OLAP queries can issue an excessive number
of tasks in highly concurrent situations
– Problem: unnecessary scheduling overhead
– Solution: concurrency hint
6
Outline
•
•
•
•
•
Introduction
Flexible concurrency level
Concurrency hint
Experimental evaluation with SAP HANA
Conclusions
7
Fixed concurrency level
• Typical task scheduling:
Bypasses the OS scheduler
Fixed
• OLTP tasks may block
Underutilization
A fixed concurrency level is not suitable for DBMS
8
Flexible concurrency level
• Issue additional workers when tasks block
• Cooperate with the OS scheduler
OS
The OS schedules the threads
Concurrency level = # of worker threads
Active Concurrency level = # of active worker threads
Active concurrency level = # H/W contexts
9
Worker states
Blocked
in syscall
Inactive
by user
Waiting
for a task
Parked
workers
Inactive Workers
Active
workers
Watchdog
Other
threads
Task Scheduler
Watchdog:
– Monitoring, statistics, and takes actions
– Keeps active concurrency level ≈ # of H/W contexts
We dynamically re-adjust the scheduler's concurrency level
10
Outline
•
•
•
•
•
Introduction
Flexible concurrency level
Concurrency hint
Experimental evaluation with SAP HANA
Conclusions
11
Partitionable operations
• Can be split in a variable number of tasks
Σ
Partition 1
Partition 2
Final result
Partition 3
1 ≤ # tasks
≤ # H/W contexts
Calculates its task granularity
• Problem: calculation independent of the
system’s concurrency situation
 High concurrency: excessive number of tasks
Unnecessary scheduling overhead
We should restrict task granularity under high concurrency
12
Restricting task granularity
Existing frameworks for data parallelism
– Not straightforward for a commercial DBMS
– Simpler way?
free worker threads = max(0,
# of H/W contexts - # active worker threads)
concurrency hint = exponential moving average of
free worker threads
The concurrency hint serves as an upper bound for # tasks
13
Concurrency hint
Low concurrency
situations
High concurrency
situations
Concurrency hint
 # H/W contexts
Concurrency hint
1
Σ
Σ
Σ
Σ
Σ
Low latency
High latency
Low scheduling overhead
Higherunder
throughput
Lightweight way to restrict task granularity
high concurrency
14
Outline
•
•
•
•
•
Introduction
Flexible concurrency level
Concurrency hint
Experimental evaluation with SAP HANA
Conclusions
15
Experimental evaluation with SAP HANA
• TPC-H SF=10
• TPC-H SF=10 + TPC-C WH=200
• Configuration:
– 8x10 Intel Xeon E7-8870 2.40 GHz, with hyperthreading,
1 TB RAM, 64-bit SMP Linux (SuSE) 2.6.32 kernel
– Several iterations. No caching. No thinking times.
• We compare:
– Fixed (fixed concurrency level)
– Flexible (flexible concurrency level)
– Hint (flexible concurrency level + concurrency hint)
16
TPC-H – Response time
Response time (sec)
150
125
Fixed
Flexible
Hint
3.5%
11.2%
100
75
50
25
0
32
288352416480
544608672736800864928992
32 96160
128 224
256
512
1024
Number of concurrent queries
Task granularity can affect OLAP performance by 11%
17
140
120
# of tasks (x10000)
Instructions retired
3E+13
2E+13
1E+13
0
Fixed
100
80
60
40
20
0
Flexible
Context Switches (x10000)
TPC-H - Measurements
100
90
80
70
60
50
40
30
20
10
0
Hint
Unnecessary overhead by too many tasks under high concurrency
18
TPC-H - Timelines
Hint
0 20 40 60 80 100120140
160
140
120
100
80
60
40
20
0
6
5
4
3
2
1
0
0
20 40 60 80 100 120
Time (sec)
Time (sec)
Active workers
# of H/W contexts
12
10
8
6
4
2
0
# of waiting tasks (x1000)
160
140
120
100
80
60
40
20
0
# of waiting tasks (x1000)
# of H/W contexts
Fixed
Waiting tasks
19
TPC-H and TPC-C
Throughput experiment
Flexible
Hint
Fixed
Flexible
Hint
TPC-H Throughput (q/min)
TPC-C
Fixed
500
3500
3000
400
2500
300
2000
200
1500
1000
100
500
0
0
TPC-C Throughput (tpmC)
TPC-H
– Variable TPC-H clients = 16-64. TPC-C clients = 200.
16
32
64
TPC-H Concurrent Clients
20
Conclusions
• Task scheduling for
– Resources management
• For DBMS
– Handle tasks that block
• Solution: flexible concurrency level
– Correlate task granularity of analytical queries with
concurrency to avoid unnecessary scheduling overhead
• Solution: concurrency hint
Thank you! Questions?
21