SlideShare a Scribd company logo
1 of 50
Download to read offline
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Understanding the impact of Scheduler
on your application
Atish Patra
Dhaval Giani
Linux Kernel Developer, Oracle
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
"You don't need to know how to operate an X-ray machine, but you do need
to know that if you swallow a penny, an X-ray is an option."
- Brendan Gregg's friend
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Program Agenda
Introduction to Scheduler
Load Balancing
Application Analysis
Scheduler Tunables
Conclusion
1
2
3
4
5
4
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Introduction
5
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Linux Scheduler
• Who gets to run when (and where)
6
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Completely Fair Scheduler
• Two tasks
• T1 runs
• Followed by T2
• Followed by T1
• …
7
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
How long?
• T1 has nice -1 and T2 has nice 0
• T1 gets to run twice as long as T2!
• nice
• weight
• vruntime
vruntime ⍺ 1/weight
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Group Scheduling
• Consider Apache spawns 1000 threads for every Oracle thread.
• Does that mean Apache gets to run 1000 times as often?
• Enter Group Scheduling
• Apache Group has all the Apache threads
• Oracle Group has all the Oracle threads
• Oracle and Apache groups have their own nice values
9
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Symmetric Multiprocessing
10
CPU 0
CPU 3CPU 2
CPU 1
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Load Balancing
• Consider
• 4 CPUs (quad core laptops!)
• 4 tasks (let’s consider same nice value)
• Each CPU gets 1
• Now consider
• 4 CPUs
• 5 tasks (1 has nice value 1)
• Now what?
11
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Load Balancing with group scheduling
• Consider Apache with 1000 threads
• Consider Oracle with 4 threads
• Apache and Oracle have same weight
• 4 CPUs. Apache gets 2, Oracle gets 2
• Now what if we had a third group with 3 threads?
12
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Non Uniform Memory Access
13
CPU 0 CPU 1 CPU 4 CPU 5
CPU 2 CPU 3 CPU 6 CPU 7
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Load Balancing
• Problems:
– Who runs where ?
– Who moves where ?
– How much movement ?
• Too much: tasks play ping pong!
• Too less: cores go idle!
14
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduling domains/groups
15
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Why scheduling domains?
• Issues
– System wide task movement and search cost
– Hardware properties
– Solution
– A hierarchal search to reduce the cost
16
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduling Domains - Example
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache
Last Level Cache
Last Level Cache
Last Level Cache
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduling Domains - SMT Domain
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache
Last Level Cache
Last Level Cache
Last Level Cache
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduling Domains - MC Domain
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache
Last Level Cache
Last Level Cache
Last Level Cache
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduling Domains - Die/CPU Domain
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache
Last Level Cache
Last Level Cache
Last Level Cache
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduling Domains - NUMA Domain
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache
Last Level Cache
Last Level Cache
Last Level Cache
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Load Balancing (Pull)
• Periodic balancing
– Happens at every scheduling tick
– Trace domain to find imbalance
– One CPU performs the search
– Frequency reduces as we traverse up the hierarchy
22
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
T1
T2
T3
T4
• New Idle balancing
– average idle time > migration_cost
– average idle time > domain search
cost
– Needs SD_BALANCE_NEWIDLE
enabled
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
• New Idle balancing
– average idle time > migration_cost
– average idle time > domain search
cost
– Needs SD_BALANCE_NEWIDLE
enabled
T1T2
T3T4
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
• Wakeup load balancing
– cache affinity
– waker-wakee relationship
– search in the same LLC domain
T1
T2
T3T4
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
• Wakeup load balancing
– cache affinity
– waker-wakee relationship
– search in the same LLC domain
T2
T3T4
Last Level Cache (LLC)
Last Level Cache (LLC)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
• Wakeup load balancing
– cache affinity
– waker-wakee relationship
– search in the same LLC domain
T2
T3T4
Last Level Cache (LLC)
Last Level Cache (LLC)
T1
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
• Wakeup load balancing
– cache affinity
– waker-wakee relationship
– search in the same LLC domain
T2
T3T4
Last Level Cache (LLC)
Last Level Cache (LLC)
T1
T5
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
• Fork/Exec load balancing
– Cache affinity might not matter
– Find the least loaded Group
– Find the least loaded CPU
– Needs SD_BALANCE_FORK/EXEC
enabled
T2
T5T4
Last Level Cache (LLC)
Last Level Cache (LLC)
T1
T3 T6
T7
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
• Fork/Exec load balancing
– Cache affinity might not matter
– Find the least loaded Group
– Find the least loaded CPU
– Needs SD_BALANCE_FORK/EXEC
enabled
T2
T5T4
Last Level Cache (LLC)
Last Level Cache (LLC)
T1
T3 T6
T7
T8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - Tools (Our experience)
• Manual instrumentation
– printk/pr_* : NO!
– trace_printk(): Maybe!
• Issues
– Kernel modification
– Parsing difficulty
36
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - perf
• Perf
– call graphs
# sudo perf record -a -g -e cycles perf bench sched 
messaging -g 1000 -l 10000
# sudo perf report --no-children -g 
-s symbol > perf_callg.out
• Difficult to process in this format
37
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - perf
• Flamegraph is immensely useful
$ sudo perf script | 
./stackcollapse-perf.pl > out.perf-folded
$./flamegraph.pl out.perf-folded > perf-kernel.svg
38
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - perf
• Use perf stat for migrations and cache-misses
$ sudo perf stat -a -e migrations -e cache-misses 
-e cache-references perf bench sched messaging 
-g 100 -l 1000
Performance counter stats for 'system wide':
7,847,249 migrations
20,950,769,373 cache-misses # 32.308 % of all cache refs (100.00%)
64,847,047,418 cache-references
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - Ftrace
•trace-cmd or manual
•Able to trace each task wakeup/migration events
#trace-cmd record -e sched:sched_wakeup_new -e sched:sched_migrate_task perf bench sched messaging -g 100 -l 100
•trace-cmd spawns a process on each processor
•Might be tricky if task migrations/wakeup analysis
40
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - Impact of Scheduling domains/
groups
41
• /proc/schedstat
– scheduling domains/groups follow hardware ?
– load balancing statistics
– Too many new idle balances especially across NUMA ?
• Try to reduce relax_domain_level
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - mpstat
• mpstat -P ALL -u 5
42
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - eBPF
• New kid on the block
•Find cpu idleness due to scheduler
•https://github.com/iovisor/bcc/blob/master/tools/
cpuunclaimed.py
43
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Application Analysis - eBPF
•Find run-queue length distribution
•https://github.com/iovisor/bcc/
blob/master/tools/runqlen.py
44
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduler Tunables
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduler Tunables
46
•sysctl -A | grep "sched" | grep -v “domain”
kernel.sched_cfs_bandwidth_slice_us = 5000
kernel.sched_child_runs_first = 0
kernel.sched_latency_ns = 24000000 (24ms)
kernel.sched_migration_cost_ns = 500000 (0.5ms)
kernel.sched_min_granularity_ns = 10000000 (10ms)
kernel.sched_nr_migrate = 32
kernel.sched_schedstats = 0
kernel.sched_time_avg_ms = 1000
kernel.sched_wakeup_granularity_ns = 15000000 (15ms)
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduler Tunables
47
• sched_migration_cost_ns: Is task cache-hot ?
Task bouncing Cores go idle
Less wakeup preemption
Reduces scheduling
delay
• sched_wakeup_granularity_ns: To preempt or not to ?
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Scheduler Tunables
48
• sched_latency_ns: Period where each task guaranteed is to run
• sched_min_granularity_ns : Minimum guaranteed runtime for a task
• sched period = max(sched_latency, nr_tasks*sched_min_granularity)
Reduces latency Improves throughput
sched_min_granularity_ns
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Conclusions
• Understand your application
• How does it interact with the system?
• Use the tools at your disposal
• Is it a scheduler issue?
• Experiment with different tunables
• Tune one at a time
• Might be a kernel bug!
Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
Thank You!
atish.patra@oracle.com
dhaval.giani@oracle.com

More Related Content

What's hot

New availability features in oracle rac 12c release 2 anair ss
New availability features in oracle rac 12c release 2 anair   ssNew availability features in oracle rac 12c release 2 anair   ss
New availability features in oracle rac 12c release 2 anair ssAnil Nair
 
Fllow con 2014
Fllow con 2014 Fllow con 2014
Fllow con 2014 gbgruver
 
Moving Graphs to Production At Scale
Moving Graphs to Production At ScaleMoving Graphs to Production At Scale
Moving Graphs to Production At ScaleNeo4j
 
Scaling Spark Workloads on YARN - Boulder/Denver July 2015
Scaling Spark Workloads on YARN - Boulder/Denver July 2015Scaling Spark Workloads on YARN - Boulder/Denver July 2015
Scaling Spark Workloads on YARN - Boulder/Denver July 2015Mac Moore
 
Large scale near real-time log indexing with Flume and SolrCloud
Large scale near real-time log indexing with Flume and SolrCloudLarge scale near real-time log indexing with Flume and SolrCloud
Large scale near real-time log indexing with Flume and SolrCloudDataWorks Summit
 
Troubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java ApplicationsTroubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java ApplicationsPoonam Bajaj Parhar
 
Next-Gen Decision Making in Under 2ms
Next-Gen Decision Making in Under 2msNext-Gen Decision Making in Under 2ms
Next-Gen Decision Making in Under 2msIlya Ganelin
 
Monitoring and Troubleshooting Tools in Java 9
Monitoring and Troubleshooting Tools in Java 9Monitoring and Troubleshooting Tools in Java 9
Monitoring and Troubleshooting Tools in Java 9Poonam Bajaj Parhar
 
Strata London 2019 Scaling Impala
Strata London 2019 Scaling ImpalaStrata London 2019 Scaling Impala
Strata London 2019 Scaling ImpalaManish Maheshwari
 
Why your Spark Job is Failing
Why your Spark Job is FailingWhy your Spark Job is Failing
Why your Spark Job is FailingDataWorks Summit
 
Deploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analyticsDeploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analyticsDataWorks Summit
 
Building a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkBuilding a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkEvan Chan
 
Tuning Apache Ambari performance for Big Data at scale with 3000 agents
Tuning Apache Ambari performance for Big Data at scale with 3000 agentsTuning Apache Ambari performance for Big Data at scale with 3000 agents
Tuning Apache Ambari performance for Big Data at scale with 3000 agentsDataWorks Summit
 
ORC File - Optimizing Your Big Data
ORC File - Optimizing Your Big DataORC File - Optimizing Your Big Data
ORC File - Optimizing Your Big DataDataWorks Summit
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeperknowbigdata
 
Serverless and you - where do i run my stateless code
Serverless and you  - where do i run my stateless codeServerless and you  - where do i run my stateless code
Serverless and you - where do i run my stateless codeGabriela Ferrara
 
Get Rid Of OutOfMemoryError messages
Get Rid Of OutOfMemoryError messagesGet Rid Of OutOfMemoryError messages
Get Rid Of OutOfMemoryError messagesPoonam Bajaj Parhar
 

What's hot (20)

New availability features in oracle rac 12c release 2 anair ss
New availability features in oracle rac 12c release 2 anair   ssNew availability features in oracle rac 12c release 2 anair   ss
New availability features in oracle rac 12c release 2 anair ss
 
Inferno Scalable Deep Learning on Spark
Inferno Scalable Deep Learning on SparkInferno Scalable Deep Learning on Spark
Inferno Scalable Deep Learning on Spark
 
Apouc 2014-enterprise-manager-12c
Apouc 2014-enterprise-manager-12cApouc 2014-enterprise-manager-12c
Apouc 2014-enterprise-manager-12c
 
Fllow con 2014
Fllow con 2014 Fllow con 2014
Fllow con 2014
 
Moving Graphs to Production At Scale
Moving Graphs to Production At ScaleMoving Graphs to Production At Scale
Moving Graphs to Production At Scale
 
Scaling Spark Workloads on YARN - Boulder/Denver July 2015
Scaling Spark Workloads on YARN - Boulder/Denver July 2015Scaling Spark Workloads on YARN - Boulder/Denver July 2015
Scaling Spark Workloads on YARN - Boulder/Denver July 2015
 
Large scale near real-time log indexing with Flume and SolrCloud
Large scale near real-time log indexing with Flume and SolrCloudLarge scale near real-time log indexing with Flume and SolrCloud
Large scale near real-time log indexing with Flume and SolrCloud
 
Troubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java ApplicationsTroubleshooting Memory Problems in Java Applications
Troubleshooting Memory Problems in Java Applications
 
Next-Gen Decision Making in Under 2ms
Next-Gen Decision Making in Under 2msNext-Gen Decision Making in Under 2ms
Next-Gen Decision Making in Under 2ms
 
Monitoring and Troubleshooting Tools in Java 9
Monitoring and Troubleshooting Tools in Java 9Monitoring and Troubleshooting Tools in Java 9
Monitoring and Troubleshooting Tools in Java 9
 
Strata London 2019 Scaling Impala
Strata London 2019 Scaling ImpalaStrata London 2019 Scaling Impala
Strata London 2019 Scaling Impala
 
Why your Spark Job is Failing
Why your Spark Job is FailingWhy your Spark Job is Failing
Why your Spark Job is Failing
 
Deploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analyticsDeploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analytics
 
Cloudera Impala
Cloudera ImpalaCloudera Impala
Cloudera Impala
 
Building a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkBuilding a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and Spark
 
Tuning Apache Ambari performance for Big Data at scale with 3000 agents
Tuning Apache Ambari performance for Big Data at scale with 3000 agentsTuning Apache Ambari performance for Big Data at scale with 3000 agents
Tuning Apache Ambari performance for Big Data at scale with 3000 agents
 
ORC File - Optimizing Your Big Data
ORC File - Optimizing Your Big DataORC File - Optimizing Your Big Data
ORC File - Optimizing Your Big Data
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
Serverless and you - where do i run my stateless code
Serverless and you  - where do i run my stateless codeServerless and you  - where do i run my stateless code
Serverless and you - where do i run my stateless code
 
Get Rid Of OutOfMemoryError messages
Get Rid Of OutOfMemoryError messagesGet Rid Of OutOfMemoryError messages
Get Rid Of OutOfMemoryError messages
 

Similar to Understanding the impact of Linux scheduler on your application

AIOUG-GroundBreakers-Jul 2019 - 19c RAC
AIOUG-GroundBreakers-Jul 2019 - 19c RACAIOUG-GroundBreakers-Jul 2019 - 19c RAC
AIOUG-GroundBreakers-Jul 2019 - 19c RACSandesh Rao
 
20190615 hkos-mysql-troubleshootingandperformancev2
20190615 hkos-mysql-troubleshootingandperformancev220190615 hkos-mysql-troubleshootingandperformancev2
20190615 hkos-mysql-troubleshootingandperformancev2Ivan Ma
 
Everything You Need to Know About MySQL Group Replication
Everything You Need to Know About MySQL Group ReplicationEverything You Need to Know About MySQL Group Replication
Everything You Need to Know About MySQL Group ReplicationNuno Carvalho
 
Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]
Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]
Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]David Buck
 
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RAC
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RACAUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RAC
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RACSandesh Rao
 
6° Sessione Oracle - CRUI: Oracle Database Appliance: Il potere dell’ingegner...
6° Sessione Oracle - CRUI: Oracle Database Appliance:Il potere dell’ingegner...6° Sessione Oracle - CRUI: Oracle Database Appliance:Il potere dell’ingegner...
6° Sessione Oracle - CRUI: Oracle Database Appliance: Il potere dell’ingegner...Jürgen Ambrosi
 
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!Tinku Ajit
 
Rac 12c rel2_operational_best_practices_sangam_2017
Rac 12c rel2_operational_best_practices_sangam_2017Rac 12c rel2_operational_best_practices_sangam_2017
Rac 12c rel2_operational_best_practices_sangam_2017Anil Nair
 
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataDatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataHakka Labs
 
20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptxIvan Ma
 
Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0Santosh Kangane
 
Exadata 12c New Features RMOUG
Exadata 12c New Features RMOUGExadata 12c New Features RMOUG
Exadata 12c New Features RMOUGFuad Arshad
 
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!Kyle Hailey
 
Analyze database system using a 3 d method
Analyze database system using a 3 d methodAnalyze database system using a 3 d method
Analyze database system using a 3 d methodAjith Narayanan
 
Ebs performance tuning session feb 13 2013---Presented by Oracle
Ebs performance tuning session  feb 13 2013---Presented by OracleEbs performance tuning session  feb 13 2013---Presented by Oracle
Ebs performance tuning session feb 13 2013---Presented by OracleAkash Pramanik
 
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...DataWorks Summit
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance TuningMark Swarbrick
 

Similar to Understanding the impact of Linux scheduler on your application (20)

AIOUG-GroundBreakers-Jul 2019 - 19c RAC
AIOUG-GroundBreakers-Jul 2019 - 19c RACAIOUG-GroundBreakers-Jul 2019 - 19c RAC
AIOUG-GroundBreakers-Jul 2019 - 19c RAC
 
20190615 hkos-mysql-troubleshootingandperformancev2
20190615 hkos-mysql-troubleshootingandperformancev220190615 hkos-mysql-troubleshootingandperformancev2
20190615 hkos-mysql-troubleshootingandperformancev2
 
Everything You Need to Know About MySQL Group Replication
Everything You Need to Know About MySQL Group ReplicationEverything You Need to Know About MySQL Group Replication
Everything You Need to Know About MySQL Group Replication
 
Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]
Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]
Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]
 
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RAC
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RACAUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RAC
AUSOUG - NZOUG-GroundBreakers-Jun 2019 - 19c RAC
 
6° Sessione Oracle - CRUI: Oracle Database Appliance: Il potere dell’ingegner...
6° Sessione Oracle - CRUI: Oracle Database Appliance:Il potere dell’ingegner...6° Sessione Oracle - CRUI: Oracle Database Appliance:Il potere dell’ingegner...
6° Sessione Oracle - CRUI: Oracle Database Appliance: Il potere dell’ingegner...
 
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
 
Chicago spark meetup-april2017-public
Chicago spark meetup-april2017-publicChicago spark meetup-april2017-public
Chicago spark meetup-april2017-public
 
Rac 12c rel2_operational_best_practices_sangam_2017
Rac 12c rel2_operational_best_practices_sangam_2017Rac 12c rel2_operational_best_practices_sangam_2017
Rac 12c rel2_operational_best_practices_sangam_2017
 
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataDatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
 
20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx
 
Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0
 
Exadata 12c New Features RMOUG
Exadata 12c New Features RMOUGExadata 12c New Features RMOUG
Exadata 12c New Features RMOUG
 
Performance Tuning intro
Performance Tuning introPerformance Tuning intro
Performance Tuning intro
 
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
 
Analyze database system using a 3 d method
Analyze database system using a 3 d methodAnalyze database system using a 3 d method
Analyze database system using a 3 d method
 
Ebs performance tuning session feb 13 2013---Presented by Oracle
Ebs performance tuning session  feb 13 2013---Presented by OracleEbs performance tuning session  feb 13 2013---Presented by Oracle
Ebs performance tuning session feb 13 2013---Presented by Oracle
 
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
Sparc solaris servers
Sparc solaris serversSparc solaris servers
Sparc solaris servers
 

Recently uploaded

Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Kalyan callg Girls, { 07738631006 } || Call Girl In Kalyan Women Seeking Men ...
Kalyan callg Girls, { 07738631006 } || Call Girl In Kalyan Women Seeking Men ...Kalyan callg Girls, { 07738631006 } || Call Girl In Kalyan Women Seeking Men ...
Kalyan callg Girls, { 07738631006 } || Call Girl In Kalyan Women Seeking Men ...Pooja Nehwal
 
Call Girls in Vashi Escorts Services - 7738631006
Call Girls in Vashi Escorts Services - 7738631006Call Girls in Vashi Escorts Services - 7738631006
Call Girls in Vashi Escorts Services - 7738631006Pooja Nehwal
 
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Pooja Nehwal
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai GapedCall Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gapedkojalkojal131
 
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...Pooja Nehwal
 
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...Call Girls in Nagpur High Profile
 
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...Call Girls in Nagpur High Profile
 
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)kojalkojal131
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Develop Keyboard Skill.pptx er power point
Develop Keyboard Skill.pptx er power pointDevelop Keyboard Skill.pptx er power point
Develop Keyboard Skill.pptx er power pointGetawu
 
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...MOHANI PANDEY
 
Lubrication and it's types and properties of the libricabt
Lubrication and it's types and properties of the libricabtLubrication and it's types and properties of the libricabt
Lubrication and it's types and properties of the libricabtdineshkumar430venkat
 
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 

Recently uploaded (20)

Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Kalyan callg Girls, { 07738631006 } || Call Girl In Kalyan Women Seeking Men ...
Kalyan callg Girls, { 07738631006 } || Call Girl In Kalyan Women Seeking Men ...Kalyan callg Girls, { 07738631006 } || Call Girl In Kalyan Women Seeking Men ...
Kalyan callg Girls, { 07738631006 } || Call Girl In Kalyan Women Seeking Men ...
 
Call Girls in Vashi Escorts Services - 7738631006
Call Girls in Vashi Escorts Services - 7738631006Call Girls in Vashi Escorts Services - 7738631006
Call Girls in Vashi Escorts Services - 7738631006
 
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
 
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai GapedCall Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
 
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
young call girls in Sainik Farm 🔝 9953056974 🔝 Delhi escort Service
 
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
 
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
VVIP Pune Call Girls Kalyani Nagar (7001035870) Pune Escorts Nearby with Comp...
 
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
 
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Develop Keyboard Skill.pptx er power point
Develop Keyboard Skill.pptx er power pointDevelop Keyboard Skill.pptx er power point
Develop Keyboard Skill.pptx er power point
 
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
 
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
(ISHITA) Call Girls Service Aurangabad Call Now 8617697112 Aurangabad Escorts...
 
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
🔝 9953056974🔝 Delhi Call Girls in Ajmeri Gate
 
Lubrication and it's types and properties of the libricabt
Lubrication and it's types and properties of the libricabtLubrication and it's types and properties of the libricabt
Lubrication and it's types and properties of the libricabt
 
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
 
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 

Understanding the impact of Linux scheduler on your application

  • 1.
  • 2. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Understanding the impact of Scheduler on your application Atish Patra Dhaval Giani Linux Kernel Developer, Oracle
  • 3. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. "You don't need to know how to operate an X-ray machine, but you do need to know that if you swallow a penny, an X-ray is an option." - Brendan Gregg's friend
  • 4. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Program Agenda Introduction to Scheduler Load Balancing Application Analysis Scheduler Tunables Conclusion 1 2 3 4 5 4
  • 5. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Introduction 5
  • 6. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Linux Scheduler • Who gets to run when (and where) 6
  • 7. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Completely Fair Scheduler • Two tasks • T1 runs • Followed by T2 • Followed by T1 • … 7
  • 8. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. How long? • T1 has nice -1 and T2 has nice 0 • T1 gets to run twice as long as T2! • nice • weight • vruntime vruntime ⍺ 1/weight
  • 9. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Group Scheduling • Consider Apache spawns 1000 threads for every Oracle thread. • Does that mean Apache gets to run 1000 times as often? • Enter Group Scheduling • Apache Group has all the Apache threads • Oracle Group has all the Oracle threads • Oracle and Apache groups have their own nice values 9
  • 10. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Symmetric Multiprocessing 10 CPU 0 CPU 3CPU 2 CPU 1 Last Level Cache (LLC) Last Level Cache (LLC)
  • 11. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Load Balancing • Consider • 4 CPUs (quad core laptops!) • 4 tasks (let’s consider same nice value) • Each CPU gets 1 • Now consider • 4 CPUs • 5 tasks (1 has nice value 1) • Now what? 11
  • 12. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Load Balancing with group scheduling • Consider Apache with 1000 threads • Consider Oracle with 4 threads • Apache and Oracle have same weight • 4 CPUs. Apache gets 2, Oracle gets 2 • Now what if we had a third group with 3 threads? 12
  • 13. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Non Uniform Memory Access 13 CPU 0 CPU 1 CPU 4 CPU 5 CPU 2 CPU 3 CPU 6 CPU 7 Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC)
  • 14. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Load Balancing • Problems: – Who runs where ? – Who moves where ? – How much movement ? • Too much: tasks play ping pong! • Too less: cores go idle! 14
  • 15. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduling domains/groups 15
  • 16. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Why scheduling domains? • Issues – System wide task movement and search cost – Hardware properties – Solution – A hierarchal search to reduce the cost 16
  • 17. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduling Domains - Example 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache Last Level Cache Last Level Cache Last Level Cache
  • 18. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduling Domains - SMT Domain 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache Last Level Cache Last Level Cache Last Level Cache
  • 19. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduling Domains - MC Domain 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache Last Level Cache Last Level Cache Last Level Cache
  • 20. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduling Domains - Die/CPU Domain 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache Last Level Cache Last Level Cache Last Level Cache
  • 21. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduling Domains - NUMA Domain 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache Last Level Cache Last Level Cache Last Level Cache
  • 22. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Load Balancing (Pull) • Periodic balancing – Happens at every scheduling tick – Trace domain to find imbalance – One CPU performs the search – Frequency reduces as we traverse up the hierarchy 22
  • 23. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC)
  • 24. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC)
  • 25. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC)
  • 26. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC) Last Level Cache (LLC)
  • 27. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. T1 T2 T3 T4 • New Idle balancing – average idle time > migration_cost – average idle time > domain search cost – Needs SD_BALANCE_NEWIDLE enabled Last Level Cache (LLC) Last Level Cache (LLC)
  • 28. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • New Idle balancing – average idle time > migration_cost – average idle time > domain search cost – Needs SD_BALANCE_NEWIDLE enabled T1T2 T3T4 Last Level Cache (LLC) Last Level Cache (LLC)
  • 29. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • Wakeup load balancing – cache affinity – waker-wakee relationship – search in the same LLC domain T1 T2 T3T4 Last Level Cache (LLC) Last Level Cache (LLC)
  • 30. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • Wakeup load balancing – cache affinity – waker-wakee relationship – search in the same LLC domain T2 T3T4 Last Level Cache (LLC) Last Level Cache (LLC)
  • 31. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • Wakeup load balancing – cache affinity – waker-wakee relationship – search in the same LLC domain T2 T3T4 Last Level Cache (LLC) Last Level Cache (LLC) T1
  • 32. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • Wakeup load balancing – cache affinity – waker-wakee relationship – search in the same LLC domain T2 T3T4 Last Level Cache (LLC) Last Level Cache (LLC) T1 T5
  • 33. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • Fork/Exec load balancing – Cache affinity might not matter – Find the least loaded Group – Find the least loaded CPU – Needs SD_BALANCE_FORK/EXEC enabled T2 T5T4 Last Level Cache (LLC) Last Level Cache (LLC) T1 T3 T6 T7
  • 34. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • Fork/Exec load balancing – Cache affinity might not matter – Find the least loaded Group – Find the least loaded CPU – Needs SD_BALANCE_FORK/EXEC enabled T2 T5T4 Last Level Cache (LLC) Last Level Cache (LLC) T1 T3 T6 T7 T8
  • 35. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis
  • 36. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - Tools (Our experience) • Manual instrumentation – printk/pr_* : NO! – trace_printk(): Maybe! • Issues – Kernel modification – Parsing difficulty 36
  • 37. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - perf • Perf – call graphs # sudo perf record -a -g -e cycles perf bench sched messaging -g 1000 -l 10000 # sudo perf report --no-children -g -s symbol > perf_callg.out • Difficult to process in this format 37
  • 38. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - perf • Flamegraph is immensely useful $ sudo perf script | ./stackcollapse-perf.pl > out.perf-folded $./flamegraph.pl out.perf-folded > perf-kernel.svg 38
  • 39. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - perf • Use perf stat for migrations and cache-misses $ sudo perf stat -a -e migrations -e cache-misses -e cache-references perf bench sched messaging -g 100 -l 1000 Performance counter stats for 'system wide': 7,847,249 migrations 20,950,769,373 cache-misses # 32.308 % of all cache refs (100.00%) 64,847,047,418 cache-references
  • 40. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - Ftrace •trace-cmd or manual •Able to trace each task wakeup/migration events #trace-cmd record -e sched:sched_wakeup_new -e sched:sched_migrate_task perf bench sched messaging -g 100 -l 100 •trace-cmd spawns a process on each processor •Might be tricky if task migrations/wakeup analysis 40
  • 41. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - Impact of Scheduling domains/ groups 41 • /proc/schedstat – scheduling domains/groups follow hardware ? – load balancing statistics – Too many new idle balances especially across NUMA ? • Try to reduce relax_domain_level
  • 42. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - mpstat • mpstat -P ALL -u 5 42
  • 43. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - eBPF • New kid on the block •Find cpu idleness due to scheduler •https://github.com/iovisor/bcc/blob/master/tools/ cpuunclaimed.py 43
  • 44. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Application Analysis - eBPF •Find run-queue length distribution •https://github.com/iovisor/bcc/ blob/master/tools/runqlen.py 44
  • 45. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduler Tunables
  • 46. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduler Tunables 46 •sysctl -A | grep "sched" | grep -v “domain” kernel.sched_cfs_bandwidth_slice_us = 5000 kernel.sched_child_runs_first = 0 kernel.sched_latency_ns = 24000000 (24ms) kernel.sched_migration_cost_ns = 500000 (0.5ms) kernel.sched_min_granularity_ns = 10000000 (10ms) kernel.sched_nr_migrate = 32 kernel.sched_schedstats = 0 kernel.sched_time_avg_ms = 1000 kernel.sched_wakeup_granularity_ns = 15000000 (15ms)
  • 47. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduler Tunables 47 • sched_migration_cost_ns: Is task cache-hot ? Task bouncing Cores go idle Less wakeup preemption
Reduces scheduling delay • sched_wakeup_granularity_ns: To preempt or not to ?
  • 48. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Scheduler Tunables 48 • sched_latency_ns: Period where each task guaranteed is to run • sched_min_granularity_ns : Minimum guaranteed runtime for a task • sched period = max(sched_latency, nr_tasks*sched_min_granularity) Reduces latency Improves throughput sched_min_granularity_ns
  • 49. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Conclusions • Understand your application • How does it interact with the system? • Use the tools at your disposal • Is it a scheduler issue? • Experiment with different tunables • Tune one at a time • Might be a kernel bug!
  • 50. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Thank You! atish.patra@oracle.com dhaval.giani@oracle.com