以下是针对Ubuntu From Scratch(UFS)的性能测试方法及工具,覆盖系统整体性能、CPU、内存、磁盘、网络等维度:
git clone https://github.com/kdlucas/byte-unixbench.git
cd byte-unixbench/UnixBench
make && ./Run
wget https://cdn.geekbench.com/Geekbench-6.2.2-Linux.tar.gz
tar -xvf Geekbench-6.2.2-Linux.tar.gz
cd Geekbench-6.2.2-Linux && ./geekbench6
sysbench cpu --cpu-max-prime=20000 run
sysbench memory --memory-block-size=1M --memory-total-size=10G run
fio --name=random_write --filename=/tmp/testfile --size=1G --rw=randwrite --bs=4k --ioengine=libaio --direct=1 --runtime=60
# 写测试
dd if=/dev/zero of=/tmp/testfile bs=1G count=1 oflag=direct
# 读测试
dd if=/tmp/testfile of=/dev/null bs=1G count=1 iflag=direct
# 服务端
iperf3 -s
# 客户端(替换为服务端IP)
iperf3 -c <server_ip> -t 30
speedtest-cli
# CPU压力(4核,60秒)
stress --cpu 4 --timeout 60
# 内存压力(分配2GB,30秒)
stress --vm 1 --vm-bytes 2G --timeout 30
sudo apt install glmark2
glmark2
以上工具和方法可根据具体测试需求组合使用,例如用fio模拟数据库负载,用iperf3测试服务器间网络性能等。