以下是针对CentOS上FetchLinux(或通用Linux系统)的性能测试方法及工具,涵盖CPU、内存、磁盘、网络等核心维度:
# 安装(CentOS)
yum install -y sysbench
# 单核测试
sysbench cpu --cpu-max-prime=20000 run
# 多核测试(指定线程数,如4核)
sysbench cpu --threads=4 --cpu-max-prime=20000 run
# 下载并运行(CentOS)
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
# 内存带宽测试(1GB数据,顺序读写)
sysbench memory --memory-block-size=1M --memory-total-size=1G --memory-access-mode=seq run
# 内存延迟测试(1GB数据,随机访问)
sysbench memory --memory-block-size=1M --memory-total-size=1G --memory-access-mode=rand run
yum install -y memtester
memtester 512M 10 # 测试512MB内存,重复10次
# 安装
yum install -y fio
# 4K随机读取测试(1GB文件,4个线程,持续60秒)
fio --name=randread --ioengine=libaio --rw=randread --bs=4k --size=1G --numjobs=4 --runtime=60 --group_reporting
# 顺序写入测试(1GB文件,1个线程)
fio --name=seqwrite --ioengine=libaio --rw=write --bs=1M --size=1G --numjobs=1 --runtime=60 --group_reporting
# 测试写入速度(1GB文件,直接写入,避免缓存影响)
dd if=/dev/zero of=/testfile bs=1G count=1 oflag=direct
# 测试读取速度
dd if=/testfile of=/dev/null bs=1G count=1 iflag=direct
rm -f /testfile
# 服务端启动
iperf3 -s
# 客户端测试(替换为服务端IP)
iperf3 -c <server_ip>
# UDP测试(需指定带宽,如1G)
iperf3 -c <server_ip> -u -b 1G
yum install -y netperf
netperf -H <server_ip> -t TCP_STREAM # TCP吞吐量测试
git clone https://github.com/kdlucas/byte-unixbench.git
cd byte-unixbench/UnixBench
make && ./Run
wget https://phoronix-test-suite.com/releases/phoronix-test-suite-10.8.4.tar.gz
tar -xvf phoronix-test-suite-10.8.4.tar.gz
cd phoronix-test-suite && ./phoronix-test-suite benchmark pts/cpu+memory+disk
sysbench/iperf3,需详细分析选fio/Geekbench。以上工具和方法可帮助全面评估CentOS系统(或FetchLinux)的性能瓶颈,指导优化方向。