1.自动化测试脚本unixbench

yum install -y wget
wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh
chmod +x unixbench.sh
./unixbench.sh

115.231.102.80:

Double-Precision Whetstone 17086.1 MWIPS (10.0 s, 7 samples)
Execl Throughput 14392.7 lps (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 476888.5 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 136850.5 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 983756.4 KBps (30.0 s, 2 samples)
Pipe Throughput 6399569.2 lps (10.0 s, 7 samples)
Pipe-based Context Switching 1416599.5 lps (10.0 s, 7 samples)
Process Creation 30040.1 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 14900.7 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 2484.1 lpm (60.1 s, 2 samples)
System Call Overhead 2247922.5 lps (10.0 s, 7 samples)

System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 152391926.4 13058.4
Double-Precision Whetstone 55.0 17086.1 3106.6
Execl Throughput 43.0 14392.7 3347.1
File Copy 1024 bufsize 2000 maxblocks 3960.0 476888.5 1204.3
File Copy 256 bufsize 500 maxblocks 1655.0 136850.5 826.9
File Copy 4096 bufsize 8000 maxblocks 5800.0 983756.4 1696.1
Pipe Throughput 12440.0 6399569.2 5144.3
Pipe-based Context Switching 4000.0 1416599.5 3541.5
Process Creation 126.0 30040.1 2384.1
Shell Scripts (1 concurrent) 42.4 14900.7 3514.3
Shell Scripts (8 concurrent) 6.0 2484.1 4140.2
System Call Overhead 15000.0 2247922.5 1498.6
========
System Benchmarks Index Score 2784.5

======= Script description and score comparison completed! =======

********

CPU
[root@ecloud log]# sysbench --test=cpu --num-threads=500 --cpu-max-prime=2000 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.6 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 500
Initializing random number generator from current time

Prime numbers limit: 2000

Initializing worker threads...

Threads started!

General statistics:
total time: 10.0111s
total number of events: 279414

Latency (ms):
min: 0.14
avg: 14.11
max: 3849.15
95th percentile: 0.15
sum: 3942001.48

Threads fairness:
events (avg/stddev): 558.8280/159.04
execution time (avg/stddev): 7.8840/1.41

2.sysbench测试工具

[root@hd1_live_video_test12 ~]# sysbench --test=cpu --num-threads=500 --cpu-max-prime=2000 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.6 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 500
Initializing random number generator from current time

Prime numbers limit: 2000

Initializing worker threads...

Threads started!

General statistics:
total time: 10.0298s
total number of events: 146550

Latency (ms):
min: 0.10
avg: 31.56
max: 2434.14
95th percentile: 0.19
sum: 4625765.20

Threads fairness:
events (avg/stddev): 293.1000/20.06
execution time (avg/stddev): 9.2515/0.46

program

[root@ecloud log]# sysbench --test=threads --num-threads=500 --thread-yields=100 --thread-locks=4 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.6 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 500
Initializing random number generator from current time

Initializing worker threads...

Threads started!

General statistics:
total time: 10.0242s
total number of events: 183556

Latency (ms):
min: 0.03
avg: 27.27
max: 505.66
95th percentile: 121.08
sum: 5005451.78

Threads fairness:
events (avg/stddev): 367.1120/33.10

[root@hd1_live_video_test12 ~]# sysbench --test=threads --num-threads=500 --thread-yields=100 --thread-locks=4 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.6 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 500
Initializing random number generator from current time

Initializing worker threads...

Threads started!

General statistics:
total time: 10.0351s
total number of events: 180507

Latency (ms):
min: 0.00
avg: 27.74
max: 717.29
95th percentile: 106.75
sum: 5006797.73

Threads fairness:
events (avg/stddev): 361.0140/18.77
execution time (avg/stddev): 10.0136/0.01

测试磁盘IO:
准备测试文件:
sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw prepare

[root@ecloud ~]# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.6 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 20
Initializing random number generator from current time

Extra file open flags: 0
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!

File operations:
reads/s: 4372.96
writes/s: 2915.30
fsyncs/s: 9322.08

Throughput:
read, MiB/s: 68.33
written, MiB/s: 45.55

General statistics:
total time: 10.0004s
total number of events: 166143

Latency (ms):
min: 0.00
avg: 1.20
max: 95.72
95th percentile: 3.43
sum: 199829.97

Threads fairness:
events (avg/stddev): 8307.1500/361.33
execution time (avg/stddev): 9.9915/0.00

[root@hd1_live_video_test12 ~]# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.6 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 20
Initializing random number generator from current time

Extra file open flags: 0
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!

File operations:
reads/s: 1762.77
writes/s: 1175.51
fsyncs/s: 3753.91

Throughput:
read, MiB/s: 27.54
written, MiB/s: 18.37

General statistics:
total time: 10.0039s
total number of events: 66961

Latency (ms):
min: 0.00
avg: 2.99
max: 96.62
95th percentile: 8.28
sum: 199961.64

Threads fairness:
events (avg/stddev): 3348.0500/129.33
execution time (avg/stddev): 9.9981/0.00

3.一键自动化测试脚本bench.sh

总结一下 bench.sh 特点:
1、显示当前测试的各种系统信息;
2、取自世界多处的知名数据中心的测试点,下载测试比较全面;
3、支持 IPv6 下载测速;
4、IO 测试三次,并显示平均值。

再配合 unixbench.sh 脚本测试,即可全面测试 VPS 的性能。

使用方法:
命令1:
wget -qO- bench.sh | bash

# ok
curl -Lso- bench.sh | bash
命令2:

wget -qO- 86.re/bench.sh | bash

curl -so- 86.re/bench.sh | bash

备注:
bench.sh 既是脚本名,同时又是域名。所以不要怀疑我写错了或者你看错了。

一键测试脚本:

#!/usr/bin/env bash
#
# Description: Auto test download & I/O speed script
#
#if  [ ! -e '/usr/bin/wget' ]; thenecho "Error: wget command not found. You must be install wget command at first."exit 1
fi# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
PLAIN='\033[0m'get_opsy() {[ -f /etc/redhat-release ] && awk '{print ($1,$3~/^[0-9]/?$3:$4)}' /etc/redhat-release && return[ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' /etc/os-release && return[ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return
}next() {printf "%-70s\n" "-" | sed 's/\s/-/g'
}speed_test() {local speedtest=$(wget -4O /dev/null -T300 $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')local ipaddress=$(ping -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')local nodeName=$2printf "${YELLOW}%-32s${GREEN}%-24s${RED}%-14s${PLAIN}\n" "${nodeName}" "${ipaddress}" "${speedtest}"
}speed_test_v6() {local speedtest=$(wget -6O /dev/null -T300 $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')local ipaddress=$(ping6 -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')local nodeName=$2printf "${YELLOW}%-32s${GREEN}%-24s${RED}%-14s${PLAIN}\n" "${nodeName}" "${ipaddress}" "${speedtest}"
}speed() {speed_test 'http://cachefly.cachefly.net/100mb.test' 'CacheFly'speed_test 'http://speedtest.tokyo.linode.com/100MB-tokyo.bin' 'Linode, Tokyo, JP'speed_test 'http://speedtest.singapore.linode.com/100MB-singapore.bin' 'Linode, Singapore, SG'speed_test 'http://speedtest.london.linode.com/100MB-london.bin' 'Linode, London, UK'speed_test 'http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin' 'Linode, Frankfurt, DE'speed_test 'http://speedtest.fremont.linode.com/100MB-fremont.bin' 'Linode, Fremont, CA'speed_test 'http://speedtest.dal05.softlayer.com/downloads/test100.zip' 'Softlayer, Dallas, TX'speed_test 'http://speedtest.sea01.softlayer.com/downloads/test100.zip' 'Softlayer, Seattle, WA'speed_test 'http://speedtest.fra02.softlayer.com/downloads/test100.zip' 'Softlayer, Frankfurt, DE'speed_test 'http://speedtest.sng01.softlayer.com/downloads/test100.zip' 'Softlayer, Singapore, SG'speed_test 'http://speedtest.hkg02.softlayer.com/downloads/test100.zip' 'Softlayer, HongKong, CN'
}speed_v6() {speed_test_v6 'http://speedtest.atlanta.linode.com/100MB-atlanta.bin' 'Linode, Atlanta, GA'speed_test_v6 'http://speedtest.dallas.linode.com/100MB-dallas.bin' 'Linode, Dallas, TX'speed_test_v6 'http://speedtest.newark.linode.com/100MB-newark.bin' 'Linode, Newark, NJ'speed_test_v6 'http://speedtest.singapore.linode.com/100MB-singapore.bin' 'Linode, Singapore, SG'speed_test_v6 'http://speedtest.tokyo.linode.com/100MB-tokyo.bin' 'Linode, Tokyo, JP'speed_test_v6 'http://speedtest.sjc03.softlayer.com/downloads/test100.zip' 'Softlayer, San Jose, CA'speed_test_v6 'http://speedtest.wdc01.softlayer.com/downloads/test100.zip' 'Softlayer, Washington, WA'speed_test_v6 'http://speedtest.par01.softlayer.com/downloads/test100.zip' 'Softlayer, Paris, FR'speed_test_v6 'http://speedtest.sng01.softlayer.com/downloads/test100.zip' 'Softlayer, Singapore, SG'speed_test_v6 'http://speedtest.tok02.softlayer.com/downloads/test100.zip' 'Softlayer, Tokyo, JP'
}io_test() {(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]*$//'
}calc_disk() {local total_size=0local array=$@for size in ${array[@]}do[ "${size}" == "0" ] && size_t=0 || size_t=`echo ${size:0:${#size}-1}`[ "`echo ${size:(-1)}`" == "K" ] && size=0[ "`echo ${size:(-1)}`" == "M" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' / 1024}' )[ "`echo ${size:(-1)}`" == "T" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' * 1024}' )[ "`echo ${size:(-1)}`" == "G" ] && size=${size_t}total_size=$( awk 'BEGIN{printf "%.1f", '$total_size' + '$size'}' )doneecho ${total_size}
}cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )
cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
freq=$( awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )
tram=$( free -m | awk '/Mem/ {print $2}' )
uram=$( free -m | awk '/Mem/ {print $3}' )
swap=$( free -m | awk '/Swap/ {print $2}' )
uswap=$( free -m | awk '/Swap/ {print $3}' )
up=$( awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d days, %d hour %d min\n",a,b,c)}' /proc/uptime )
load=$( w | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//' )
opsy=$( get_opsy )
arch=$( uname -m )
lbit=$( getconf LONG_BIT )
kern=$( uname -r )
ipv6=$( wget -qO- -t1 -T2 ipv6.icanhazip.com )
disk_size1=($( LANG=C df -ahPl | grep -wvE '\-|none|tmpfs|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $2}' ))
disk_size2=($( LANG=C df -ahPl | grep -wvE '\-|none|tmpfs|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $3}' ))
disk_total_size=$( calc_disk ${disk_size1[@]} )
disk_used_size=$( calc_disk ${disk_size2[@]} )clear
next
echo "CPU model            : $cname"
echo "Number of cores      : $cores"
echo "CPU frequency        : $freq MHz"
echo "Total size of Disk   : $disk_total_size GB ($disk_used_size GB Used)"
echo "Total amount of Mem  : $tram MB ($uram MB Used)"
echo "Total amount of Swap : $swap MB ($uswap MB Used)"
echo "System uptime        : $up"
echo "Load average         : $load"
echo "OS                   : $opsy"
echo "Arch                 : $arch ($lbit Bit)"
echo "Kernel               : $kern"
next
io1=$( io_test )
echo "I/O speed(1st run)   : $io1"
io2=$( io_test )
echo "I/O speed(2nd run)   : $io2"
io3=$( io_test )
echo "I/O speed(3rd run)   : $io3"
ioraw1=$( echo $io1 | awk 'NR==1 {print $1}' )
[ "`echo $io1 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw1=$( awk 'BEGIN{print '$ioraw1' * 1024}' )
ioraw2=$( echo $io2 | awk 'NR==1 {print $1}' )
[ "`echo $io2 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw2=$( awk 'BEGIN{print '$ioraw2' * 1024}' )
ioraw3=$( echo $io3 | awk 'NR==1 {print $1}' )
[ "`echo $io3 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw3=$( awk 'BEGIN{print '$ioraw3' * 1024}' )
ioall=$( awk 'BEGIN{print '$ioraw1' + '$ioraw2' + '$ioraw3'}' )
ioavg=$( awk 'BEGIN{printf "%.1f", '$ioall' / 3}' )
echo "Average I/O speed    : $ioavg MB/s"
next
printf "%-32s%-24s%-14s\n" "Node Name" "IPv4 address" "Download Speed"
speed && next
if [[ "$ipv6" != "" ]]; thenprintf "%-32s%-24s%-14s\n" "Node Name" "IPv6 address" "Download Speed"speed_v6 && next
fi

***

测试aliyun双核8G内存云主机:
test12_aliyun_2 cpu 8 G memory

[root@hd1_live_video_test12 data]# curl -Lso- bench.sh | bash
----------------------------------------------------------------------
CPU model : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
Number of cores : 2
CPU frequency : 2593.748 MHz
Total size of Disk : 60.0 GB (6.1 GB Used)
Total amount of Mem : 7872 MB (5308 MB Used)
Total amount of Swap : 0 MB (0 MB Used)
System uptime : 16 days, 15 hour 29 min
Load average : 0.08, 0.17, 0.08
OS : CentOS 6.8
Arch : x86_64 (64 Bit)
Kernel : 2.6.32-642.6.2.el6.x86_64
----------------------------------------------------------------------
I/O speed(1st run) : 56.4 MB/s
I/O speed(2nd run) : 55.6 MB/s
I/O speed(3rd run) : 56.2 MB/s
Average I/O speed : 56.1 MB/s
----------------------------------------------------------------------
Node Name IPv4 address Download Speed
CacheFly 204.93.150.152 300KB/s
Linode, Tokyo, JP 106.187.96.148 16.8MB/s
Linode, Singapore, SG 139.162.23.4 42.5KB/s
Linode, London, UK 176.58.107.39 9.12MB/s
Linode, Frankfurt, DE 139.162.130.8 9.07MB/s
Linode, Fremont, CA 50.116.14.9 1.92MB/s
Softlayer, Dallas, TX 173.192.68.18 12.0MB/s
Softlayer, Seattle, WA 67.228.112.250 4.97MB/s
Softlayer, Frankfurt, DE 159.122.69.4 3.96MB/s
Softlayer, Singapore, SG 119.81.28.170 31.1KB/s
Softlayer, HongKong, CN 119.81.130.170 29.8KB/s

服务器性能自动化测试脚本相关推荐

  1. 云服务器测速脚本_服务器性能自动化测试脚本

    1.自动化测试脚本unixbench yum install -y wget wget --no-check-certificate https://github.com/teddysun/acros ...

  2. linux 测试路由速度慢,LINUX服务器性能常用测试脚本 – 硬件信息/网速/延迟/路由等...

    SuperBench.sh 脚本: wget -qO- git.io/superbench.sh | bash curl -LsO git.io/superbench.sh; chmod +x sup ...

  3. 基于python的界面自动化测试-Python实现性能自动化测试竟然如此简单

    一.思考❓❔ 1.什么是性能自动化测试? 性能系统负载能力超负荷运行下的稳定性系统瓶颈自动化测试使用程序代替手工提升测试效率性能自动化使用代码模拟大批量用户让用户并发请求多页面多用户并发请求采集参数, ...

  4. 怎么自学python自动化测试-Python实现性能自动化测试竟然如此简单

    一.思考❓❔ 1.什么是性能自动化测试? 性能系统负载能力超负荷运行下的稳定性系统瓶颈自动化测试使用程序代替手工提升测试效率性能自动化使用代码模拟大批量用户让用户并发请求多页面多用户并发请求采集参数, ...

  5. python 硬件自动化测试_村长告诉你:Python实现性能自动化测试竟然如此简单

    一.思考 1.什么是性能自动化测试? ◆性能 △ 系统负载能力 △ 超负荷运行下的稳定性 △ 系统瓶颈 ◆自动化测试 △ 使用程序代替手工 △ 提升测试效率 ◆性能自动化 △ 使用代码模拟大批量用户 ...

  6. python自动化测试-Python实现性能自动化测试竟然如此简单

    一.思考❓❔ 1.什么是性能自动化测试? 性能系统负载能力超负荷运行下的稳定性系统瓶颈自动化测试使用程序代替手工提升测试效率性能自动化使用代码模拟大批量用户让用户并发请求多页面多用户并发请求采集参数, ...

  7. 【转】linux服务器性能查看

    转载自https://blog.csdn.net/achenyuan/article/details/78974729 1.1 cpu性能查看 1.查看物理cpu个数: cat /proc/cpuin ...

  8. linux系统服务器性能综合测试(UnixBench5)

    使用 UnixBench5 进行linux系统服务器性能综合测试 1.简介 Unixbench是一个类unix系(Unix,BSD,Linux)统下的性能测试工具,一个开源工具,被广泛用与测试linu ...

  9. c# 服务器性能监控,C#服务器性能监控之WMI的代码示例详解

    1.WMI简介 WMI是英文Windows Management Instrumentation的简写,通过使用WMI,我们可以获取本地或远程服务器的性能参数和进程运行情况,以及大部分硬件信息,但前提 ...

最新文章

  1. Leetcode - 169. Majority Element (多数投票问题)
  2. Ambari2.7.4+HDP3.1.4.0中配置fair-scheduler
  3. Python2.7-sqlite3
  4. 基于ARM IP的看门狗设计与功能验证
  5. resnet10 从tk1 上移植到linux 上 上遇到的问题
  6. 黄聪:JQUERY的datatables插件,Date range filter时间段筛选功能
  7. python爬虫简单步骤_python爬虫小demo,简单明了
  8. vrep中视觉传感器(Vision sensor)
  9. 2022年考研华中科技大学计算机学院硕士后记
  10. stm32 带通滤波器_PCB设计中建立带通滤波器波特图
  11. Rhcsa第二次课堂练习
  12. 违反GPL协议赔偿50万,国内首例!
  13. POSCMS 邮件服务器配置
  14. 华为坠亡员工博客称“心累”
  15. 纯html+css打造一款特殊的生日贺卡
  16. VUE动态生成word
  17. CentOS7系统root分区文件损坏修复的解决方法
  18. 二进制编译安装启动Redis时报权限不够(redis.service: Failed at step EXEC spawning xxx: Permission denied)
  19. java输出数据超过5个换行
  20. Matlab-VISSIM联合仿真

热门文章

  1. 032_smallpdf
  2. Filter过滤器的生命周期和工作原理
  3. codeforces 546E
  4. 暗影精灵3 黑苹果Mojave(14.5)安装 个人详细记录
  5. 【锐捷无线】AC集群配置
  6. HTG至少评论了Ouya游戏机:非常适合模拟器
  7. Cisco AIR-LAP1131AG-C-K9刷胖AP
  8. sourcetree跳过注册的方法
  9. 互联网日报 | 5月15日 星期六 | 阿里巴巴普惠体2.0发布;淘宝直播2021财年GMV超5000亿元;福佑卡车赴美IPO...
  10. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?...