我们在购买一款VPS之前,除了看看网友对其品牌的反应,自己也可以动手测试一下VPS的一些性能,毕竟大部分的销售商都支持30天退款。在这三十天内,可以做很多测试。本篇文章就介绍下常用的VPS性能测试脚步。
最先做的是需要获取系统信息
UnixBench测试
wget -qO- bench.sh | bash #或者以下命令 curl -Lso- bench.sh | bash
unixbench是一个用于测试unix系统性能的工具,也是一个比较通用的benchmark, 此测试的目的是对类Unix 系统提供一个基本的性能指示,很多测试用于系统性能的不同方面,这些测试的结果是一个指数值(index value,如520),这个值是测试系统的测试结果与一个基线系统测试结果比较得到的指数值,这样比原始值更容易得到参考价值,测试集合里面所有的测试得到的指数值结合起来得到整个系统的指数值。
各项的测试有得分,然后有一个综合的得分,这样可以很方便的通过分数去比较。
源于1995 年,基线系统是“George”,一个工作站:SPARCstation 20‐61,128MB RAM,Solaris2.3,此系统的指数值被设定为10,所以,如果一个系统的最后结果分数为520,意思是指此系统比基线系统运行快52 倍。
UnixBench也包含一些非常简单的2D和3D图形测试。
UnixBench也支持多CPU系统的测试,默认的行为是测试两次,第一次是一个进程的测试,第二次是N份测试,N等于CPU个数。这样的设计是为了以下目标:
-
测试系统的单任务性能
-
测试系统的多任务性能
-
测试系统并行处理的能力
UnixBench一个基于系统的基准测试工具,不单纯是CPU 内存 或者磁盘测试工具。测试结果不仅仅取决于硬件,也取决于系统、开发库、甚至是编译器。
yum -y install gcc automake autoconf libtool make wget wget http://www.52vps.net/scripts/UnixBench.tar.gz tar -zxvf UnixBench.tar.gz cd unixbench-4.1.0-wht-2 make ./Run

Wget下载速度测试
需要使用Wget进行下载测试,有的系统默认没有安装Wget,需要提前安装
yum -y wget #如果没有安装 wget,需要这一句,否则,这一句省略 wget http://cachefly.cachefly.net/100mb.test && rm -f 100mb.test
原理是下载100mb的文件来进行测试
SpeedTest测试
使用比较流行的speedtest-cli工具进行测试:
curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py chmod +x speedtest-cli
speedtest-cli 支持很多命令,
$ speedtest-cli -h
usage: speedtest-cli [-h] [--no-download] [--no-upload] [--bytes] [--share]
[--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
[--csv-header] [--json] [--list] [--server SERVER]
[--mini MINI] [--source SOURCE] [--timeout TIMEOUT]
[--secure] [--no-pre-allocate] [--version]
Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli
optional arguments:
-h, --help show this help message and exit
--no-download Do not perform download test
--no-upload Do not perform upload test
--bytes Display values in bytes instead of bits. Does not
affect the image generated by --share, nor output from
--json or --csv
--share Generate and provide a URL to the speedtest.net share
results image, not displayed with --csv
--simple Suppress verbose output, only show basic information
--csv Suppress verbose output, only show basic information
in CSV format. Speeds listed in bit/s and not affected
by --bytes
--csv-delimiter CSV_DELIMITER
Single character delimiter to use in CSV output.
Default ","
--csv-header Print CSV headers
--json Suppress verbose output, only show basic information
in JSON format. Speeds listed in bit/s and not
affected by --bytes
--list Display a list of speedtest.net servers sorted by
distance
--server SERVER Specify a server ID to test against
--mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10
--secure Use HTTPS instead of HTTP when communicating with
speedtest.net operated servers
--no-pre-allocate Do not pre allocate upload data. Pre allocation is
enabled by default to improve upload performance. To
support systems with insufficient memory, use this
option to avoid a MemoryError
--version Show the version number and exit
目前该项目托管在github上,主页地址: https://github.com/sivel/speedtest-cli, 感兴趣的朋友可以好好研究下,老鸟以后会专门写这方面的文章。
国内访问VPS的延迟情况
推荐大家使用 https://www.17ce.com/ 进行测试
硬盘性能测试
dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync && rm -f test dd if=/dev/zero of=test bs=8k count=256k conv=fdatasync && rm -f test
出站入站速度测试
wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py chmod a+rx speedtest_cli.py mv speedtest_cli.py /usr/local/bin/speedtest-cli chown root:root /usr/local/bin/speedtest-cli speedtest-cli --list
看的出,也是借用了speedtest-cli这个工具
以上这些测试能从一定程度上反应一款主机的质量,当然,主机最最重要的一项是稳定运行,这个需要时间,基本上一个月能看出来。老鸟手上的搬瓦工VPS的稳定性还不错,貌似还没有重启过。
未经允许不得转载:主机达人 » 常用VPS性能测试脚步总结
主机达人



