Rodrigo Freire - Rhel 6 Performance & Tuning
Rodrigo Freire - Rhel 6 Performance & Tuning
Rodrigo Freire
Sr. Technical Account Manager
22/Mai/2014
Agenda
CPU
Memory
I/O
Network
Performance or Reliability?
Faster transactions?
or
Efficiency?
Tradeoffs
Risks
Cost
Basic OS Setup
CPU Isolation?
Be aware of BIOS making Power Management
decisions
Efficiency decision
Bandwidth: Maximum
possible throughput
Throughput: Current
bandwidth usage
More bandwidth?
Non-linear $/performance
Benefits?
In a nutshell...
RHEL6 Performance
Improvements
10
Component
Feature
CPU/Kernel
Memory
Networking
Block
11
default
kernel.sched_min_
granularity_ns
4ms
10ms
10ms
10ms
10ms
kernel.sched_wakeup
_granularity_ns
4ms
15ms
15ms
15ms
15ms
vm.dirty_ratio
20% RAM
40%
10%
40%
40%
vm.dirty_background
_ratio
10% RAM
5%
vm.swappiness
60
10
30
I/O Scheduler
(Elevator)
CFQ
deadline
deadline
deadline
Filesystem Barriers On
Off
Off
Off
CPU Governor
performance
Disk Read-ahead
ondemand
latency-perfo throughput-pe
rmance
rformance
deadline
deadline
performance
performance
4x
Disable THP
Yes
Disable C-States
Yes
12
Block Devices
13
Available Technologies
14
Solid-State Device
Spinning HDD
250K
200K
150K
100K
50K
K
15
Noop
CFQ
Deadline
1Guest
2 Guests
4 Guests
16
17
Monitoring:
Use powertop, or turbostat from kernel source
18
CPU Tuning
Variable frequencies
Multiple cores
Power saving modes (cpuspeed governors)
performance
ondemand
userspace
Examples:
echo "performance" > \
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Best of both worlds cron jobs to configure the governor mode using
tuned-adm
tuned-adm profile {default,latency-performance}
19
Scheduler Policies
20
SMIs
Broken BIOS!
21
22
Standard pages: 4 kB
[root@rfreire~]#(disableTHP)
[root@rfreire~]#timememhog1g
real
user
sys
23
0m0.600s
0m0.186s
0m0.412s
Less L1 TLB
consumption
Memory intensive: WIN!
real
user
sys
0m0.303s
0m0.199s
0m0.100s
Introduced in RHEL6.0
Anonymous memory only (swappable, can be disabled)
Can coexist with traditional hugepages
Does not require application support (anon memory).
In RHEL6.2, added counters...explained in transhuge.txt
# egrep 'trans|thp' /proc/vmstat
nr_anon_transparent_hugepages 2018
thp_fault_alloc 7302
thp_fault_fallback 0
thp_collapse_alloc 401
thp_collapse_alloc_failed 0
thp_split 21
24
CPU-Bound
Access Cost
25
NUMA
NUMA
27
lspci output:
0001:06:00.0 Ethernet controller: Solarflare Communications SFC9020 [Solarstorm]
# cat /sys/devices/pci0000\:00/0000\:00\:00.0/local_cpulist
0,2,4,6
# cat /sys/devices/pci0001\:40/0001\:40\:00.0/local_cpulist
1,3,5,7
# dmesg|grep "NUMA node"
pci_bus 0000:00: on NUMA node 0 (pxm 0)
pci_bus 0001:40: on NUMA node 1 (pxm 1)
28
29
Network
30
Network Determinism
31
Buffer Bloat
Buffers are everywhere... www.bufferbloat.net
http://www.bufferbloat.net/projects/bloat/wiki/Introd
uction
Find out about your buffers.
Use 'ss -e' or 'netstat -nt'
NIC ring buffers and new Byte Queue Limits
http://linuxplumbersconf.org/2011/ocw/sessi
ons/171
https://lwn.net/Articles/454390/
32
33
Invented to allow
Linux networking to
scale along with
hardware
2 socket/8 cores
extremely common,
optimize for this
use-case
Hash of src/dst
IP:PORT determines
receiving CPU
34
Perftun guide
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/Performance_Tuning_Guide
/index.html
Systemtap:
https://access.redhat.com/site/solutions/5441
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/SystemTap_Beginners_Guide/inde
x.html
Benchmarking tools:
https://access.redhat.com/site/solutions/173863
Tuned:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Power_Management_Guide/Tune
d.html
Seekwatcher & blktrace:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/ch06
s03.html
Process Schedulers:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_MRG/2/html/Realtime_Reference_Guide/chap-R
ealtime_Reference_Guide-Priorities_and_policies.html
Memory tuning:
https://access.redhat.com/site/solutions/16995
Numad:
https://access.redhat.com/site/articles/223693
RPS and RSS:
35
https://access.redhat.com/site/solutions/62869
36
THANK YOU!
Rodrigo Freire
[email protected]
http://people.redhat.com/rfreire/cce-perftun-bsb.pdf