CentOS系统性能测试指南
性能测试是评估CentOS系统CPU、内存、磁盘、网络等资源性能的关键手段,以下是常用工具及具体操作方法:
yum -y install sysbench
;sysbench cpu --threads=<CPU核心数> --events=10000 run
;total time
(总时间),时间越短,CPU性能越好。wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/byte-unixbench/UnixBench5.1.3.tgz
),解压后安装gcc/perl;./Run -c <核心数>
(-c 1
测单核,-c N
测多核);CPU index
(指数越高,CPU性能越好)。sysbench memory --memory-block-size=1K --memory-total-size=4G --memory-access-mode=rnd --threads=<核心数> run
;Total operations
(总操作数)和Total time
(总时间),操作数越多、时间越短,内存性能越好。yum -y install stress
;stress --vm 4 --vm-bytes=50M --timeout=600
(模拟4个进程,每个进程占用50MB内存,持续600秒);top
命令),是否出现OOM(内存溢出)。yum -y install fio
;fio --ioengine=libaio --bs=4k --direct=1 --thread --time_based --rw=randread --filename=/home/testfile --runtime=60 --numjobs=4 --group_reporting
;fio --ioengine=libaio --bs=4k --direct=1 --thread --time_based --rw=write --filename=/home/testfile --runtime=60 --numjobs=4 --group_reporting
;IOPS
(每秒输入/输出操作数,越高越好)和BW
(带宽,单位MB/s,越大越好)。yum -y install hdparm
;hdparm -Tt /dev/sda
(-T
测缓存读取速度,-t
测磁盘实际读取速度);iperf3 -s
(启动服务端);iperf3 -c <服务器IP>
(测试到服务器的带宽);Bandwidth
(带宽,单位Mbps/Gbps,越高越好)和Jitter
(延迟抖动,越小越稳定)。--size
、--runtime
、--numjobs
),使测试结果更贴合实际;