Original link: https://wsgzao.github.io/post/linux-performance/
foreword
Linux performance testing, monitoring, and optimization is an ongoing process. The picture above is a schematic diagram of the Linux benchmarking tools
shared by Brendan D. Gregg at LinuxCon, which covers a wide range of topics. We can capture most of the information through mature monitoring solutions such as Prometheus and Zabbix. In actual work, we will often pay attention to performance issues such as CPU, Memory, I/O, and Network. This article adds Ni Pengfei’s “Linux” produced by Geek Time. Performance Optimization Practice” column course study notes.
Donald Knuth said “premature optimization is the root of all evil”
update record
October 18, 2022 – Added Linux performance optimization in action
August 31, 2022 – Added bench.sh and yabs.sh
March 06, 2015 – first draft
Read the original article – https://wsgzao.github.io/post/linux-performance/
Extended reading
Linux Performance – http://www.brendangregg.com/linuxperf.html
CPU
Confirm CPU model
1 |
cat /proc/cpuinfo |grep "model name" |uniq|cut -f2 -d: |
Super PI
The shorter the computation time, the better
1 |
|
Disk
Empty the cache
It is recommended to clear the cache before each read and write test
1 |
sync; echo 3 > /proc/sys/vm/drop_caches |
hdparm -t /dev/sda
/dev/sda:
Timing buffered disk reads: 1074 MB in 3.00 seconds = 357.92 MB/sec
1 |
|
time dd if=/dev/zero of=/tmp/speed bs=1M count=2K conv=fsync;rm /tmp/speed
1 |
|
wget -qO-bench.sh | bash
curl -Lso-bench.sh | bash
1 |
|
curl -sL yabs.sh | bash
wget -qO- yabs.sh | bash
`
This script has been tested on the following Linux distributions: CentOS 6+, Debian 8+, Fedora 30, and Ubuntu 16.04+. It is designed to not require any external dependencies to be installed nor elevated privileges to run.
Local fio/iperf3 Packages: If the tested system has fio and/or iperf3 already installed, the local package will take precedence over the precompiled binary.
Experimental ARM Compatibility: Initial ARM compatibility has been introduced, however, is not considered entirely stable due to limited testing on distinct ARM devices. Report any errors or issues.
High Bandwidth Usage Notice: By default, this script will perform many iperf network tests, which will try to max out the network port for ~20s per location (10s in each direction). Low-bandwidth servers (such as a NAT VPS) should consider running this script with the -r flag (for reduced iperf locations) or the -i flag (to disable network tests entirely).
Linux performance optimization in practice
Linux performance optimization practice Ni Pengfei Senior Linux expert, Kubernetes project maintainer
https://time.geekbang.org/column/intro/100020901
Linux performance optimization practical notes
Linux performance optimization
https://feiyang233.club/post/linux/
This article is reprinted from: https://wsgzao.github.io/post/linux-performance/
This site is for inclusion only, and the copyright belongs to the original author.