Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Compile linux 5.0 kernel benchmark
#!/bin/bash
mv /root/logs.txt /root/logs_`date +%s`.txt 2>/dev/null || true
exec &> >(tee -a "/root/logs.txt")
systemctl restart systemd-timesyncd
start_time=`date +%s`
export DEBIAN_FRONTEND=noninteractive
echo "==========================================="
echo " UPDATE SYSTEM"
echo "==========================================="
start_time_update=`date +%s`
time apt -q update 2>&1
time apt -yq upgrade 2>&1
end_time_update=`date +%s`
echo "==========================================="
echo " Install build deps"
echo "==========================================="
start_time_apt_install=`date +%s`
time apt -yq install git build-essential kernel-package fakeroot libncurses5-dev libssl-dev ccache flex bison libelf-dev jq fio ioping 2>&1
end_time_apt_install=`date +%s`
echo "==========================================="
echo " Download kernel from cdn"
echo "==========================================="
start_time_download_kernel=`date +%s`
time wget -q -O linux-5.0.tar.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.tar.xz 2>&1
end_time_download_kernel=`date +%s`
echo "==========================================="
echo " Extract kernel"
echo "==========================================="
start_time_extract_kernel=`date +%s`
rm -rf linux-5.0
time tar -xf linux-5.0.tar.xz 2>&1
end_time_extract_kernel=`date +%s`
echo "==========================================="
echo " Configure kernel"
echo "==========================================="
start_time_configure_kernel=`date +%s`
pushd linux-5.0
time (make defconfig ; make clean) 2>&1
sed -i 's/CONFIG_STACK_VALIDATION=y/CONFIG_STACK_VALIDATION=n/' .config
sed -i 's/CONFIG_UNWINDER_ORC=y/CONFIG_UNWINDER_ORC=n/' .config
sed -i 's/# CONFIG_UNWINDER_FRAME_POINTER is not set/CONFIG_UNWINDER_FRAME_POINTER=y/' .config
end_time_configure_kernel=`date +%s`
echo "==========================================="
echo " Compile kernel"
echo "==========================================="
start_time_compile_kernel=`date +%s`
time make -s -j $(grep -c ^processor /proc/cpuinfo) 2>&1
end_time_compile_kernel=`date +%s`
end_time=`date +%s`
runtime=$((end_time-start_time))
echo "==========================================="
echo "Whole bench execution time: "$runtime" seconds"
echo "==========================================="
echo "==========================================="
echo " Verify compiled kernel"
echo "==========================================="
dd if=arch/x86/boot/bzImage bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' arch/x86/boot/bzImage | cut -d ':' -f 1) | zcat 2>/dev/null | grep -a 'Linux version'
echo "==========================================="
echo " Running disk benchmarks"
echo "==========================================="
dd_sequential_write_speed_64k=`(LANG=C dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && rm -f test_$$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//'`
dd_sequential_write_speed_256k=`(LANG=C dd if=/dev/zero of=test_$$ bs=256k count=16k conv=fdatasync && rm -f test_$$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//'`
fio_bench_64k=`fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=64k --iodepth=64 --size=4G --readwrite=randrw --time_based --runtime=60 --rwmixread=75 --output-format=json`
fio_bench_256k=`fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=256k --iodepth=256 --size=4G --readwrite=randrw --time_based --runtime=60 --rwmixread=75 --output-format=json`
rm -f test
fio_read_iops_mean_64k=`echo $fio_bench_64k | jq '.jobs[].read.iops_mean'`
fio_write_iops_mean_64k=`echo $fio_bench_64k | jq '.jobs[].write.iops_mean'`
fio_read_iops_mean_256k=`echo $fio_bench_256k | jq '.jobs[].read.iops_mean'`
fio_write_iops_mean_256k=`echo $fio_bench_256k | jq '.jobs[].write.iops_mean'`
ioping_seek_rate=`ioping -DR -w 5 . | tail -n 1`
ioping_sequential_read=`ioping -DRL -w 5 . | tail -n 2 | head -n 1`
mv /root/bench.txt /root/bench_`date +%s`.txt 2>/dev/null || true
tee /root/bench.txt << EOF
Kernel_bench seconds
Update_system: $((end_time_update-start_time_update))
Install_build_deps: $((end_time_apt_install-start_time_apt_install))
Download_kernel: $((end_time_download_kernel-start_time_download_kernel))
Extract_kernel: $((end_time_extract_kernel-start_time_extract_kernel))
Configure_kernel: $((end_time_configure_kernel-start_time_configure_kernel))
Compile_kernel: $((end_time_compile_kernel-start_time_compile_kernel))
Total: $((end_time-start_time))
Disk_bench:
Seq_write_speed_64k $dd_sequential_write_speed_64k
Seq_write_speed_256k $dd_sequential_write_speed_256k
Read_iops_mean_64k $fio_read_iops_mean_64k
Write_iops_mean_64k $fio_write_iops_mean_64k
Read_iops_mean_256k $fio_read_iops_mean_256k
Write_iops_mean_256k $fio_write_iops_mean_256k
Ioping_seek_rate $ioping_seek_rate
Ioping_seq_read $ioping_sequential_read
EOF
@versionsix

This comment has been minimized.

Copy link
Owner Author

versionsix commented Mar 6, 2019

AWS Ligstsail 5,00USD-1GB-1VCPU-40GSSD
Time till ssh: about 30 seconds

Kernel_bench        seconds
Update_system:      117
Install_build_deps: 133
Download_kernel:    3
Extract_kernel:     13
Configure_kernel:   9
Compile_kernel:     1128
Total:              1403
Disk_bench:
Seq_write_speed_64k  65.5 MB/s
Seq_write_speed_256k 64.1 MB/s
Read_iops_mean_64k   991.233333
Write_iops_mean_64k  330.925
Read_iops_mean_256k  242.9
Write_iops_mean_256k 80.35
Ioping_seek_rate     min/avg/max/mdev = 159.8 us / 271.2 us / 3.08 ms / 85.9 us
Ioping_seq_read      generated 1.47 k requests in 5.00 s, 366.2 MiB, 292 iops, 73.2 MiB/s

Azure PAYGO 93,41USD+-8GB-2VCPU-32GSSD (D2s-v3 + P4 SSD)
Time till ssh: 234 seconds

Kernel_bench        seconds
Update_system:      75
Install_build_deps: 226
Download_kernel:    1
Extract_kernel:     20
Configure_kernel:   48
Compile_kernel:     960
Total:              1330
Disk_bench:
Seq_write_speed_64k  23.0 MB/s
Seq_write_speed_256k 32.0 MB/s
Read_iops_mean_64k   401.65
Write_iops_mean_64k  133.425
Read_iops_mean_256k  99.325
Write_iops_mean_256k 33.941667
Ioping_seek_rate     min/avg/max/mdev = 33.5 us / 231.8 us / 35.0 ms / 1.91 ms
Ioping_seq_read      generated 677 requests in 5.03 s, 169.2 MiB, 134 iops, 33.6 MiB/s

Hetzner Cloud 5,54USD-4GB-2VCPU-40GSSD (CX21)
Time till ssh: 15 seconds

Kernel_bench        seconds
Update_system:      36
Install_build_deps: 25
Download_kernel:    1
Extract_kernel:     9
Configure_kernel:   6
Compile_kernel:     431
Total:              508
Disk_bench:
Seq_write_speed_64k  376 MB/s
Seq_write_speed_256k 429 MB/s
Read_iops_mean_64k   13166.202703
Write_iops_mean_64k  4395.864865
Read_iops_mean_256k  37726
Write_iops_mean_256k 12585.133333
Ioping_seek_rate     min/avg/max/mdev = 33.0 us / 64.3 us / 6.29 ms / 43.4 us
Ioping_seq_read      generated 26.6 k requests in 5.00 s, 6.49 GiB, 5.32 k iops, 1.30 GiB/s

Hetzner Cloud 5,54USD-4GB-2VCPU-40GSSD (CX21-CEPH)
Time till ssh: 20 seconds

Kernel_bench        seconds
Update_system:      49
Install_build_deps: 36
Download_kernel:    1
Extract_kernel:     12
Configure_kernel:   7
Compile_kernel:     519
Total:              624
Disk_bench:
Seq_write_speed_64k  368 MB/s
Seq_write_speed_256k 780 MB/s
Read_iops_mean_64k   3004.866667
Write_iops_mean_64k  1003.216667
Read_iops_mean_256k  3003.383333
Write_iops_mean_256k 1003.116667
Ioping_seek_rate     min/avg/max/mdev = 88.0 us / 519.1 us / 13.8 ms / 387.3 us
Ioping_seq_read      generated 2.55 k requests in 5.00 s, 637 MiB, 509 iops, 127.4 MiB/s

Digital ocean: 40USD-4GB-2VCPU-25GSSD
Time till ssh: 30 sec

Kernel_bench        seconds
Update_system:      1
Install_build_deps: 62
Download_kernel:    1
Extract_kernel:     8
Configure_kernel:   6
Compile_kernel:     423
Total:              501
Disk_bench:
Seq_write_speed_64k  404 MB/s
Seq_write_speed_256k 505 MB/s
Read_iops_mean_64k   8250.908333
Write_iops_mean_64k  2759.95
Read_iops_mean_256k  2360.508333
Write_iops_mean_256k 784.516667
Ioping_seek_rate     min/avg/max/mdev = 91.1 us / 152.6 us / 5.30 ms / 52.0 us
Ioping_seq_read      generated 4.37 k requests in 5.00 s, 1.07 GiB, 874 iops, 218.6 MiB/s
@versionsix

This comment has been minimized.

Copy link
Owner Author

versionsix commented Apr 23, 2019

Netcup eipower 1

Kernel_bench        seconds
Update_system:      3
Install_build_deps: 110
Download_kernel:    2
Extract_kernel:     8
Configure_kernel:   8
Compile_kernel:     289
Total:              420
Disk_bench:
Seq_write_speed_64k  295 MB/s
Seq_write_speed_256k 465 MB/s
Read_iops_mean_64k   4075.025
Write_iops_mean_64k  1361.591667
Read_iops_mean_256k  1464.533333
Write_iops_mean_256k 489.233333
Ioping_seek_rate     min/avg/max/mdev = 34.1 us / 60.3 us / 1.09 ms / 105.0 us
Ioping_seq_read      generated 9.82 k requests in 5.00 s, 2.40 GiB, 1.96 k iops, 491.2 MiB/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.