其实从网上搜vps的性能测试也能找到差不多的工具,现在列一下
我没有用过的:
1.bogomips
http://www.clifton.nl/index.html?bogomips.html
用来测试CPU 速度的
2.lmbench
http://www.bitmover.com/lmbench/whatis_lmbench.html
Tools for performance analysis
说明中建议最好不要在X下面测试
以上内容from http://101oio.javaeye.com/blog/374652
我用过的程序sysbench等(这些可以在源里搜bench),unixbench测试工具
sysbench在源里都有
http://www.ningoo.net/html/2009/performance_test_tool_sysbench.html
性能测试工具sysbench简介 作者:NinGoo | 【转载须以超链接形式标明文章原始出处和作者信息】 sysbench是一款开源的多线程性能测试工具,可以执行CPU/内存/线程/IO/数据库等方面的性能测试。数据库目前支持MySQL/Oracle/PostgreSQL。本文只是简单演示一下几种测试的用法,后续准备利用sysbench来对MySQL进行一系列的测试。具体的一些参数设置,需要根据不同的测试要求来进行调整。 下载 http://sourceforge.net/projects/sysbench/ 编译安装 默认支持MySQL,如果需要测试Oracle/PostgreSQL,则在configure时需要加上–with-oracle或者–with-pgsql参数 ./configure --prefix=/u01/sysbench / --with-mysql-includes=/opt/mysql/include/mysql / --with-mysql-libs=/opt/mysql/lib/mysql make && make install 参数 NinGoo:/u01/sysbench/bin>$sysbench Missing required command argument. Usage: sysbench [general-options]... --test= [test-options]... command General options: --num-threads=N number of threads to use [1] --max-requests=N limit for total number of requests [10000] --max-time=N limit for total execution time in seconds [0] --forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off] --thread-stack-size=SIZE size of stack per thread [32K] --init-rng=[on|off] initialize random number generator [off] --test=STRING test to run --debug=[on|off] print more debugging info [off] --validate=[on|off] perform validation checks where possible [off] --help=[on|off] print help and exit --version=[on|off] print version and exit Compiled-in tests: fileio - File I/O test cpu - CPU performance test memory - Memory functions speed test threads - Threads subsystem performance test mutex - Mutex performance test oltp - OLTP test Commands: prepare run cleanup help version See 'sysbench --test= help' for a list of options for each test. CPU测试 sysbench采用寻找最大素数的方式来测试CPU的性能 NinGoo:/u01/sysbench/bin>$sysbench --test=cpu --cpu-max-prime=2000 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing CPU performance benchmark Threads started! Done. Maximum prime number checked in CPU test: 2000 Test execution summary: total time: 2.3996s total number of events: 10000 total time taken by event execution: 2.3917 per-request statistics: min: 0.23ms avg: 0.24ms max: 27.44ms approx. 95 percentile: 0.24ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 2.3917/0.00 线程测试 NinGoo:/u01/sysbench/bin>$sysbench --test=threads --num-threads=64 --thread-yields=100 / --thread-locks=2 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 64 Doing thread subsystem performance test Thread yields per test: 100 Locks used: 2 Threads started! Done. Test execution summary: total time: 4.3925s total number of events: 10000 total time taken by event execution: 280.4418 per-request statistics: min: 0.04ms avg: 28.04ms max: 72.81ms approx. 95 percentile: 52.29ms Threads fairness: events (avg/stddev): 156.2500/1.43 execution time (avg/stddev): 4.3819/0.01 文件IO性能测试 首先生成需要的测试文件,文件总大小300M,16个并发线程,随机读写模式。执行完后会在当前目录下生成一堆小文件。 NinGoo:/u01/sysbench/bin>$sysbench --test=fileio --num-threads=16 / --file-total-size=300M --file-test-mode=rndrw prepare sysbench 0.4.12: multi-threaded system evaluation benchmark 128 files, 2400Kb each, 300Mb total Creating files for the test... 执行测试 NinGoo:/u01/sysbench/bin>$sysbench --test=fileio --num-threads=16 / --file-total-size=300M --file-test-mode=rndrw run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 16 Extra file open flags: 0 128 files, 2.3438Mb each 300Mb total file size Block size 16Kb Number of random requests for random IO: 10000 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 Threads started! Done. Operations performed: 5996 Read, 4004 Write, 12800 Other = 22800 Total Read 93.688Mb Written 62.562Mb Total transferred 156.25Mb (26.713Mb/sec) 1709.66 Requests/sec executed Test execution summary: total time: 5.8491s total number of events: 10000 total time taken by event execution: 12.5045 per-request statistics: min: 0.01ms avg: 1.25ms max: 373.28ms approx. 95 percentile: 0.03ms Threads fairness: events (avg/stddev): 625.0000/109.60 execution time (avg/stddev): 0.7815/0.29 清理现场 NinGoo:/u01/sysbench/bin>$sysbench --test=fileio --num-threads=16 / --file-total-size=300M --file-test-mode=rndrw cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark Removing test files... Mutex测试 NinGoo:/u01/sysbench/bin>$sysbench --test=mutex --num-threads=16 / --mutex-num=1024 --mutex-locks=10000 --mutex-loops=5000 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 16 Doing mutex performance test Threads started! Done. Test execution summary: total time: 1.1561s total number of events: 16 total time taken by event execution: 18.3831 per-request statistics: min: 1084.60ms avg: 1148.94ms max: 1153.52ms approx. 95 percentile: 10000000.00ms Threads fairness: events (avg/stddev): 1.0000/0.00 execution time (avg/stddev): 1.1489/0.02 内存测试 NinGoo:/u01/sysbench/bin>$sysbench --test=memory --num-threads=16 / --memory-block-size=8192 --memory-total-size=1G run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 16 Doing memory operations speed test Memory block size: 8K Memory transfer size: 1024M Memory operations type: write Memory scope type: global Threads started! WARNING: Operation time (0.000000) is less than minimal counted value, counting as 1.000000 WARNING: Percentile statistics will be inaccurate Done. Operations performed: 131072 (114162.68 ops/sec) 1024.00 MB transferred (891.90 MB/sec) Test execution summary: total time: 1.1481s total number of events: 131072 total time taken by event execution: 16.0448 per-request statistics: min: 0.00ms avg: 0.12ms max: 3.60ms approx. 95 percentile: 0.01ms Threads fairness: events (avg/stddev): 8192.0000/192.89 execution time (avg/stddev): 1.0028/0.00 MySQL数据库测试 首先需要创建默认的sbtest数据库,或者使用–mysql-db指定一个已经存在的数据库 生成测试数据,引擎为myisam,表大小为1000000条记录 NinGoo:/u01/sysbench/bin>$sysbench --test=oltp --mysql-table-engine=myisam --oltp-table-size=1000000 / --mysql-user=root --mysql-socket=/opt/mysql/run/mysql.sock prepare sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Creating table 'sbtest'... Creating 1000000 records in table 'sbtest'... root@sbtest 11:42:18>desc sbtest.sbtest; +-------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | k | int(10) unsigned | NO | MUL | 0 | | | c | char(120) | NO | | | | | pad | char(60) | NO | | | | +-------+------------------+------+-----+---------+----------------+ 执行测试 NinGoo:/u01/sysbench/bin>$sysbench --test=oltp --mysql-table-engine=myisam --oltp-table-size=1000000 / --mysql-user=root --mysql-socket=/opt/mysql/run/mysql.sock run sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Running the test with following options: Number of threads: 1 Doing OLTP test. Running mixed OLTP test Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases) Using "LOCK TABLES WRITE" for starting transactions Using auto_inc on the id column Maximum number of requests for OLTP test is limited to 10000 Threads started! Done. OLTP test statistics: queries performed: read: 140000 write: 50000 other: 20000 total: 210000 transactions: 10000 (336.64 per sec.) deadlocks: 0 (0.00 per sec.) read/write requests: 190000 (6396.11 per sec.) other operations: 20000 (673.27 per sec.) Test execution summary: total time: 29.7056s total number of events: 10000 total time taken by event execution: 29.6301 per-request statistics: min: 2.27ms avg: 2.96ms max: 43.88ms approx. 95 percentile: 3.36ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 29.6301/0.00 清理现场 NinGoo:/u01/sysbench/bin>$sysbench --test=oltp --mysql-table-engine=myisam --oltp-table-size=1000000 / --mysql-user=root --mysql-socket=/opt/mysql/run/mysql.sock cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Dropping table 'sbtest'... Done. 本文网址:http://www.ningoo.net/html/2009/performance_test_tool_sysbench.html
UnixBench是一款不错的Linux下的VPS性能测试工具
http://www.ctohome.com/FuWuQi/c5/172.html
ssh登录您的linux vps控制台,运行下面的1行命令即可: wget http://www.CTOHome.com/linux-vps-pack/unixbench.sh;sh ./unixbench.sh; 此脚本会自动下载unixbench测试工具,并自动运行它。 根据您的机器性能,测试执行完大约需要5-10分钟, Linux VPS性能测试的结果类似如下: BYTE UNIX Benchmarks (Version 4.1-wht.2) System -- Linux vps59.ctohome.com 2.6.18-164.2.1.el5.028stab066.10 #1 SMP Sat Dec 12 18:52:53 MSK 2009 i686 i686 i386 GNU/Linux /dev/simfs 157286400 1112188 156174212 1% / Start Benchmark Run: Tue Dec 22 00:46:05 MSK 2009 00:46:05 up 5:51, 1 user, load average: 0.07, 0.03, 0.01 End Benchmark Run: Tue Dec 22 00:58:44 MSK 2009 00:58:44 up 6:04, 2 users, load average: 14.37, 6.12, 2.80 INDEX VALUES TEST BASELINE RESULT INDEX Dhrystone 2 using register variables 376783.7 16303866.8 432.7 Double-Precision Whetstone 83.1 1299.8 156.4 Execl Throughput 188.3 7725.8 410.3 File Copy 1024 bufsize 2000 maxblocks 2672.0 165150.0 618.1 File Copy 256 bufsize 500 maxblocks 1077.0 55402.0 514.4 File Read 4096 bufsize 8000 maxblocks 15382.0 1577261.0 1025.4 Pipe-based Context Switching 15448.6 600615.4 388.8 Pipe Throughput 111814.6 2184246.1 195.3 Process Creation 569.3 22116.2 388.5 Shell Scripts (8 concurrent) 44.8 1213.8 270.9 System Call Overhead 114433.5 1758851.2 153.7 ========= FINAL SCORE 354.5 这就是我的VPS的总分数,2.5G内存,Q6600,跑了KLOXO面板,硬盘有raid 一般来说,对于VPS,测试分数在100分以上就算OK了,有一些低配置的P4独立服务器才30-80分。 VPS都是多个共用一个服务器资源,所以,不要盲目的追求高分,测试结果并不代表您可以使用到这么多资源。 提供一些测试结果以供参考对比: TekTonic VPS, 1178 MB SLM Ram BYTE UNIX Benchmarks (Version 4.1-wht.1) System -- Linux www1 2.6.18-028stab053.17 #1 SMP Mon Jun 9 20:42: 43 MSD 2008 x86_64 x86_64 x86_64 GNU/Linux /dev/vzfs 54525952 1002732 53523220 2% / Start Benchmark Run: Sun Jul 20 07:22:37 EDT 2008 07:22:37 up 10 days, 15:20, 1 user, load average: 0.10, 0.03, 0.01 End Benchmark Run: Sun Jul 20 07:32:51 EDT 2008 07:32:51 up 10 days, 15:30, 1 user, load average: 12.54, 5.50, 2.42 INDEX VALUES TEST BASELINE RESULT INDEX Dhrystone 2 using register variables 376783.7 39636370.0 1052.0 Double-Precision Whetstone 83.1 2777.2 334.2 Execl Throughput 188.3 1.0 0.1 File Copy 1024 bufsize 2000 maxblocks 2672.0 168410.0 630.3 File Copy 256 bufsize 500 maxblocks 1077.0 55239.0 512.9 File Read 4096 bufsize 8000 maxblocks 15382.0 1213185.0 788.7 Pipe-based Context Switching 15448.6 778065.9 503.6 Pipe Throughput 111814.6 2639096.8 236.0 Process Creation 569.3 15147.9 266.1 Shell Scripts (8 concurrent) 44.8 934.8 208.7 System Call Overhead 114433.5 2216242.0 193.7 ========= FINAL SCORE 179.1 Intel(R) Xeon(R) CPU X3220 @ 2.40GHz BYTE UNIX Benchmarks (Version 4.1-wht.1) System -- Linux xxx.x*********** 2.6.18-92.1.6.el5 #1 SMP Fri Jun 20 02:36:06 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux /dev/sda5 15235040 842868 13605792 6% / Start Benchmark Run: Sun Jul 20 14:29:30 CEST 2008 14:29:30 up 2 days, 14:21, 2 users, load average: 0.08, 0.02, 0.00 End Benchmark Run: Sun Jul 20 14:39:09 CEST 2008 14:39:09 up 2 days, 14:31, 2 users, load average: 17.45, 7.24, 3.03 INDEX VALUES TEST BASELINE RESULT INDEX Dhrystone 2 using register variables 376783.7 52964762.4 1405.7 Double-Precision Whetstone 83.1 2646.5 318.5 Execl Throughput 188.3 1.0 0.1 File Copy 1024 bufsize 2000 maxblocks 2672.0 177760.0 665.3 File Copy 256 bufsize 500 maxblocks 1077.0 60598.0 562.7 File Read 4096 bufsize 8000 maxblocks 15382.0 1349778.0 877.5 Pipe-based Context Switching 15448.6 1082390.9 700.6 Pipe Throughput 111814.6 3437748.3 307.5 Process Creation 569.3 38647.5 678.9 Shell Scripts (8 concurrent) 44.8 2730.5 609.5 System Call Overhead 114433.5 2765994.1 241.7 ========= FINAL SCORE 242.2 Core Intel Core2Quad Q9300 RAM 8gb DDR2 Hard Drive 750gb SATA Operating System CentOS 5.1 - 64 bit ============================================================== BYTE UNIX Benchmarks (Version 4.1-wht.1) System -- Linux hxxxxx.xxxxxxx.xxxx 2.6.25.11 #1 SMP Fri Jul 18 05:54:37 CDT 2008 x86_64 x86_64 x86_64 GNU/Linux 707556656 58223196 612811888 9% / Start Benchmark Run: Sun Jul 27 09:44:54 GMT+7 2008 09:44:54 up 7 days, 3:07, 1 user, load average: 0.15, 0.19, 0.18 End Benchmark Run: Sun Jul 27 09:54:51 GMT+7 2008 09:54:51 up 7 days, 3:17, 1 user, load average: 14.32, 6.43, 2.95 INDEX VALUES TEST BASELINE RESULT INDEX Dhrystone 2 using register variables 376783.7 53071766.3 1408.5 Double-Precision Whetstone 83.1 2861.6 344.4 Execl Throughput 188.3 1.0 0.1 File Copy 1024 bufsize 2000 maxblocks 2672.0 244096.0 913.5 File Copy 256 bufsize 500 maxblocks 1077.0 76926.0 714.3 File Read 4096 bufsize 8000 maxblocks 15382.0 1637081.0 1064.3 Pipe-based Context Switching 15448.6 1098145.9 710.8 Pipe Throughput 111814.6 3682570.6 329.3 Process Creation 569.3 37471.9 658.2 Shell Scripts (8 concurrent) 44.8 2216.0 494.6 System Call Overhead 114433.5 3057039.6 267.1 ========= FINAL SCORE 259.8 Intel(R) Xeon(R) CPU X3230 @ 2.66GHz BYTE UNIX Benchmarks (Version 4.1-wht.2) System -- Linux ccitest 2.6.18-164.6.1.el5xen #1 SMP Tue Nov 3 16:48:13 EST 2009 x86_64 x86_64 x86_64 GNU/Linux /dev/xvda2 101471352 1570008 94663756 2% / Start Benchmark Run: Sun Dec 6 14:23:18 CST 2009 14:23:18 up 4 min, 1 user, load average: 0.81, 0.41, 0.17 End Benchmark Run: Sun Dec 6 14:34:46 CST 2009 14:34:46 up 15 min, 1 user, load average: 15.65, 6.77, 3.15 INDEX VALUES TEST BASELINE RESULT INDEX Dhrystone 2 using register variables 376783.7 5882030.5 156.1 Double-Precision Whetstone 83.1 1817.5 218.7 Execl Throughput 188.3 1857.2 98.6 File Copy 1024 bufsize 2000 maxblocks 2672.0 65269.0 244.3 File Copy 256 bufsize 500 maxblocks 1077.0 18173.0 168.7 File Read 4096 bufsize 8000 maxblocks 15382.0 486529.0 316.3 Pipe-based Context Switching 15448.6 109886.6 71.1 Pipe Throughput 111814.6 381731.2 34.1 Process Creation 569.3 3960.7 69.6 Shell Scripts (8 concurrent) 44.8 465.8 104.0 System Call Overhead 114433.5 280372.8 24.5 ========= FINAL SCORE 106.0 i5 750 @ 2.67GHz / 8GB RAM / 2x1TB SATA software RAID-1 Start Benchmark Run: Mon Dec 7 17:06:20 EST 2009 17:06:20 up 5 days, 12:02, 1 user, load average: 0.00, 0.72, 1.22 End Benchmark Run: Mon Dec 7 17:16:55 EST 2009 17:16:55 up 5 days, 12:13, 1 user, load average: 25.08, 9.95, 4.80 INDEX VALUES TEST BASELINE RESULT INDEX Dhrystone 2 using register variables 376783.7 22952878.3 609.2 Double-Precision Whetstone 83.1 1704.0 205.1 Execl Throughput 188.3 21480.3 1140.7 File Copy 1024 bufsize 2000 maxblocks 2672.0 571200.0 2137.7 File Copy 256 bufsize 500 maxblocks 1077.0 162227.0 1506.3 File Read 4096 bufsize 8000 maxblocks 15382.0 3540312.0 2301.6 Pipe-based Context Switching 15448.6 1536398.3 994.5 Pipe Throughput 111814.6 5856215.7 523.7 Process Creation 569.3 69004.5 1212.1 Shell Scripts (8 concurrent) 44.8 4626.7 1032.7 System Call Overhead 114433.5 7226715.6 631.5 ========= FINAL SCORE 927.1 (i系列的cpu就是性能不错,这个也是硬盘做了raid) VPS - Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz Dhrystone 2 using register variables 376783.7 19026940.3 505.0 Double-Precision Whetstone 83.1 1354.1 162.9 Execl Throughput 188.3 15340.8 814.7 File Copy 1024 bufsize 2000 maxblocks 2672.0 398171.0 1490.2 File Copy 256 bufsize 500 maxblocks 1077.0 118935.0 1104.3 File Read 4096 bufsize 8000 maxblocks 15382.0 2625333.0 1706.8 Pipe-based Context Switching 15448.6 330750.1 214.1 Pipe Throughput 111814.6 3511603.3 314.1 Process Creation 569.3 41223.9 724.1 Shell Scripts (8 concurrent) 44.8 4683.0 1045.3 System Call Overhead 114433.5 3465020.7 302.8 ========= FINAL SCORE 587.9 dedicated - Intel(R) Xeon(R) CPU X3230 @ 2.66GHz Dhrystone 2 using register variables 376783.7 23765477.8 630.7 Double-Precision Whetstone 83.1 1824.7 219.6 Execl Throughput 188.3 13823.9 734.1 File Copy 1024 bufsize 2000 maxblocks 2672.0 182964.0 684.7 File Copy 256 bufsize 500 maxblocks 1077.0 60123.0 558.2 File Read 4096 bufsize 8000 maxblocks 15382.0 1454686.0 945.7 Pipe-based Context Switching 15448.6 1118260.2 723.9 Pipe Throughput 111814.6 3788722.7 338.8 Process Creation 569.3 40686.2 714.7 Shell Scripts (8 concurrent) 44.8 2989.5 667.3 System Call Overhead 114433.5 3079164.4 269.1 ========= FINAL SCORE 540.8