Top Banner
Performance optimizaton on Linux By Peter Toth [email protected]
17

Performance optimization on Linux by Peter Toth

Jan 15, 2015

Download

Engineering

tothphu

The slides for my presentation about Peformance tuning on Linux which I presented to Auckland Linux Users Group
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Performance optimization on Linux by Peter Toth

Performance optimizaton on LinuxBy Peter Toth

[email protected]

Page 2: Performance optimization on Linux by Peter Toth

Intro

What do you want to learn today?

What level are you interested in? Any specific requests? Have you ever optimized Linux or an application for Linux?

Assuming everyone is familiar with Linux concepts and basic architecture

Page 3: Performance optimization on Linux by Peter Toth

Agenda

MethodologyKnow your…Optimisable hardware components

Page 4: Performance optimization on Linux by Peter Toth

Methodology

DocumentStart on a clean systemEmpty caches - warmup cachesAutomate testing (clear caches every time)Step-by-stepKeep those changes which are significantEstablish baselineThink about side-effectsAvoid trial-and-error

Page 5: Performance optimization on Linux by Peter Toth

Know your ...

ApplicationHardwareLinux (environment)

Page 6: Performance optimization on Linux by Peter Toth

Application

Fix bugs! aka. optimize lastRun at least -O2Multi-threadingStructure the program to be efficient on the hardware and Linuxstructure size alignment (cache-line, IO)are all POSIX/OS features used?

If in doubt test!

Page 7: Performance optimization on Linux by Peter Toth

Hardware

Select hardware for the taskStudy the hardware you’ve selected: CPU, HT, memory, NUMA, SSD, disks, iGPU, TDP/SDPTweak the SW for the HW (think SSE, AVX)Tune HW specifics through /sys

Page 8: Performance optimization on Linux by Peter Toth

Linux

Page 9: Performance optimization on Linux by Peter Toth

Linux interfaces

Run up-to-date (OS+gcc+libs)/proc - more OS/sys - more HWsysctlkernel command_linekernel configtop, ntop, iotopvmstat, iostatuname

Page 10: Performance optimization on Linux by Peter Toth

Benchmark

consistent benchmarkingcomprehensive Linux application benchmarking: Phoronix Test Suite

Page 11: Performance optimization on Linux by Peter Toth

Profiling

perfoprofilestracevalgrind

Page 12: Performance optimization on Linux by Peter Toth

CPU/NUMA

CoresCaches (cache line size)Layout (physical to logical mapping)AffinityScheduling

Page 13: Performance optimization on Linux by Peter Toth

I/O

Filesystem: ext4, xfs, btrfsScheduling: noop, cfq, deadlinehdparmqueues buffersIO block sizespinning media vs SSDAIO

Page 14: Performance optimization on Linux by Peter Toth

Memory

page sizehuge pagesmadviseswappingpage cachememory overcommitingpage faultsmemory fragmentation

Page 15: Performance optimization on Linux by Peter Toth

Power Management

consolidate old hw -> virtualizeschedulerpowertopturn off unused hardware (isolcpus, network)scheduler (use tickless)C statesP states: frequency-voltage combinations

Page 16: Performance optimization on Linux by Peter Toth

Networking

Throughput or latency (RT Linux?) use your HWverify link speedssegmentation offloadnetwork buffersper socket bufferszero copyTCP congestion control algorithmstools: ethtool, iperf, netstat, wireshark!

Page 17: Performance optimization on Linux by Peter Toth

Thank You!

Questions?