前言:如今,云server主流。它已成为许多中小型企业的首选server,但是云server它是一个虚拟机。所以性能是一个大问题,从这里开始介绍云server性能测试,云webserver压力测试。

Linux下经常使用的四款Webserver压力測试工具(http_load、webbench、ab、siege),这里採用apache自带的ab工具来測试。

1,開始安装apache

前期准备:

yum install gcc* -y

yum install libtool* -y

1.1,去官网下载

apache,http://httpd.apache.org/download.cgi#apache24

下载软件包是:httpd-2.4.12.tar.gz

解压tar -zxvf httpd-2.2.6.tar.gz,完毕之后,会在当前文件夹出现一个httpd-2.2.6文件夹,然后顺序运行例如以下命令改名:

tar -zxvf httpd-2.2.6.tar.gz
mv httpd-2.2.6 apache
cd apache

设置安装參数,命令例如以下:

./configure –prefix=/usr/local/apache2 –enable-module=so –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util

[root@bwebhttpd-2.4.12]# ./configure --prefix=/usr/local/apache2 --enable-module=so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
[root@bwebhttpd-2.4.12]#

<版权全部,文章同意转载,但必须以链接方式注明源地址,否则追究法律责任!>

原博客地址: http://blog.csdn.net/mchdba/article/details/46381741

原作者:黄杉 (mchdba)

报错APR…问题


1.2 解决apr not found问题

http://apr.apache.org/download.cgi下载

wget http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz。然后源代码安装

[root@bwebdata]# cd apr-1.4.6
[root@bwebapr-1.4.6]# ./configure --prefix=/usr/local/apr
[root@bwebapr-1.4.6]# make
[root@bwebapr-1.4.6]# make install

1.3.解决APR-util not found问题

须要安装apr-util组件:

[root@bwebdata]# wget http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz
[root@bwebdata]# tar -xvf apr-util-1.5.4.tar.gz
[root@bwebdata]# cd apr-util-1.5.4
[root@bwebapr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
[root@bwebapr-util-1.5.4]# make
[root@bwebapr-util-1.5.4]# make install

或者 yum install -y apr-util*

1.4 configure: error: pcre-config for libpcre not found问题

../configure加入了–with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util仍提示 configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/的错误

查看下是否有pcre參数

[root@bwebhttpd-2.4.12]# ./configure -help | grep pcre

–with-pcre=PATH Use external PCRE library

[root@bwebhttpd-2.4.12]#

没有这个參数。所以须要又一次下载安装:

下载pcre,下载地址一:http://sourceforge.net/projects/pcre 下载地址二:http://ftp.exim.llorien.org/pcre/

[root@bwebdata]# wget http://ftp.exim.llorien.org/pcre/pcre-8.36.tar.gz
--这里由于下载失败。所以又一次去csdn资源库下载了pcre的zip包
[root@bwebdata]# unzip pcre-8.36.zip
[root@bwebdata]# cd pcre-8.36
[root@bwebpcre-8.36]# ./configure --prefix=/usr/local/pcre
[root@bwebpcre-8.36]# make
[root@bwebpcre-8.36]# make install

或者 yum安装也能够:

[root@bwebhttpd-2.4.12]# yum install -y pcre*

必要的组件安装完了。我们能够继续源代码编译apache了

2 最后编译安装apache

[root@bwebhttpd-2.4.12]# ./configure --prefix=/usr/local/apache2 --enable-module=so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-included-apr
[root@bwebhttpd-2.4.12]# make
[root@bwebhttpd-2.4.12]# make install

启动apache

/usr/local/apache2/bin/apachectl start

[root@bwebhttpd-2.4.12]#  /usr/local/apache2/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.16.1.4. Set the 'ServerName' directive globally to suppress this message
[root@bwebhttpd-2.4.12]#

查看下:

在浏览器中输入地址:http://172.16.1.4/,会显演示样例如以下信息:

It works!

apache安装完毕后ab命令存放在apache安装文件夹的bin文件夹下。例如以下:

[root@bwebhttpd-2.4.12]# ll /usr/local/apache2/bin
total 2308
-rwxr-xr-x. 1 root root 80799 Jun 4 12:48 ab
-rwxr-xr-x. 1 root root 3438 Jun 4 12:43 apachectl
-rwxr-xr-x. 1 root root 23515 Jun 4 12:43 apxs
-rwxr-xr-x. 1 root root 12277 Jun 4 12:48 checkgid
-rwxr-xr-x. 1 root root 8925 Jun 4 12:43 dbmmanage
-rw-r--r--. 1 root root 1073 Jun 4 12:43 envvars
-rw-r--r--. 1 root root 1073 Jun 4 12:43 envvars-std
-rwxr-xr-x. 1 root root 20200 Jun 4 12:48 fcgistarter
-rwxr-xr-x. 1 root root 66594 Jun 4 12:48 htcacheclean
-rwxr-xr-x. 1 root root 40674 Jun 4 12:48 htdbm
-rwxr-xr-x. 1 root root 22263 Jun 4 12:48 htdigest
-rwxr-xr-x. 1 root root 41346 Jun 4 12:48 htpasswd
-rwxr-xr-x. 1 root root 1933978 Jun 4 12:48 httpd
-rwxr-xr-x. 1 root root 19488 Jun 4 12:48 httxt2dbm
-rwxr-xr-x. 1 root root 21908 Jun 4 12:48 logresolve
-rwxr-xr-x. 1 root root 34593 Jun 4 12:48 rotatelogs
[root@bwebhttpd-2.4.12]#

/usr/local/apache2/bin/ab -c 1000 -n 1000 http://127.0.0.1/phpinfo.php

3,ab压測结果例如以下:

3.1 微软云压測

ab压測结果例如以下:

[root@bwebhttpd-2.4.12]# /usr/local/apache2/bin/ab -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests Server Software: Apache/2.4.12
Server Hostname: 127.0.0.1
Server Port: 80 Document Path: /phpinfo.php
Document Length: 209 bytes Concurrency Level: 1000
Time taken for tests: 0.676 seconds
Complete requests: 1000
Failed requests: 0
Non-2xx responses: 1000
Total transferred: 387000 bytes
HTML transferred: 209000 bytes
Requests per second: 1478.80 [#/sec] (mean)
Time per request: 676.224 [ms] (mean)
Time per request: 0.676 [ms] (mean, across all concurrent requests)
Transfer rate: 558.88 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 4 28 20.1 14 65
Processing: 4 90 155.1 18 608
Waiting: 3 87 156.2 13 608
Total: 16 118 169.9 29 665 Percentage of the requests served within a certain time (ms)
50% 29
66% 52
75% 266
80% 267
90% 270
95% 662
98% 663
99% 663
100% 665 (longest request)
[root@bwebhttpd-2.4.12]

下面是加带了-k參数。表示不释放连接:

ab -k -c 1000 -n 1000 http://127.0.0.1/phpinfo.php

[root@bwebhttpd-2.4.12]# /usr/local/apache2/bin/ab -k -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests Server Software: Apache/2.4.12
Server Hostname: 127.0.0.1
Server Port: 80 Document Path: /phpinfo.php
Document Length: 209 bytes Concurrency Level: 1000
Time taken for tests: 5.136 seconds
Complete requests: 1000
Failed requests: 125
(Connect: 0, Receive: 0, Length: 125, Exceptions: 0)
Non-2xx responses: 885
Keep-Alive requests: 877
Total transferred: 374749 bytes
HTML transferred: 184965 bytes
Requests per second: 194.69 [#/sec] (mean)
Time per request: 5136.408 [ms] (mean)
Time per request: 5.136 [ms] (mean, across all concurrent requests)
Transfer rate: 71.25 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 18 25.2 0 73
Processing: 1 1342 2013.5 12 5060
Waiting: 1 728 1499.3 11 5060
Total: 1 1360 2023.8 45 5130 Percentage of the requests served within a certain time (ms)
50% 45
66% 1137
75% 2201
80% 4997
90% 5005
95% 5128
98% 5129
99% 5129
100% 5130 (longest request)
[root@bwebhttpd-2.4.12]#

3.2 华为云压測

[root@hwweb02 httpd-2.4.12]# /usr/local/apache2/bin/ab -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests Server Software: Apache/2.4.12
Server Hostname: 127.0.0.1
Server Port: 80 Document Path: /phpinfo.php
Document Length: 209 bytes Concurrency Level: 1000
Time taken for tests: 0.642 seconds
Complete requests: 1000
Failed requests: 0
Non-2xx responses: 1000
Total transferred: 387000 bytes
HTML transferred: 209000 bytes
Requests per second: 1558.26 [#/sec] (mean)
Time per request: 641.742 [ms] (mean)
Time per request: 0.642 [ms] (mean, across all concurrent requests)
Transfer rate: 588.91 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 16 11.5 8 30
Processing: 8 101 170.6 20 609
Waiting: 2 98 171.8 18 609
Total: 15 116 176.2 25 634 Percentage of the requests served within a certain time (ms)
50% 25
66% 45
75% 231
80% 234
90% 238
95% 632
98% 634
99% 634
100% 634 (longest request)
[root@hwweb02 httpd-2.4.12]#

下面是加带了-k參数。表示不释放连接:

    [root@hwweb02 httpd-2.4.12]#  /usr/local/apache2/bin/ab -k -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests Server Software: Apache/2.4.12
Server Hostname: 127.0.0.1
Server Port: 80 Document Path: /phpinfo.php
Document Length: 209 bytes Concurrency Level: 1000
Time taken for tests: 6.265 seconds
Complete requests: 1000
Failed requests: 100
(Connect: 0, Receive: 0, Length: 100, Exceptions: 0)
Non-2xx responses: 910
Keep-Alive requests: 900
Total transferred: 385300 bytes
HTML transferred: 190190 bytes
Requests per second: 159.62 [#/sec] (mean)
Time per request: 6264.951 [ms] (mean)
Time per request: 6.265 [ms] (mean, across all concurrent requests)
Transfer rate: 60.06 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 10 12.9 0 29
Processing: 0 1425 2150.0 8 6235
Waiting: 0 934 1811.3 8 6235
Total: 0 1434 2155.1 8 6261 Percentage of the requests served within a certain time (ms)
50% 8
66% 1402
75% 2419
80% 3416
90% 5004
95% 6260
98% 6261
99% 6261
100% 6261 (longest request)
[root@hwweb02 httpd-2.4.12]#

3.3 idc机房測试

    [root@idc_web~]# /usr/bin/ab -k -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests Server Software: Apache/2.2.15
Server Hostname: 127.0.0.1
Server Port: 80 Document Path: /phpinfo.php
Document Length: 286 bytes Concurrency Level: 1000
Time taken for tests: 0.341 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Non-2xx responses: 1000
Keep-Alive requests: 0
Total transferred: 466000 bytes
HTML transferred: 286000 bytes
Requests per second: 2929.00 [#/sec] (mean)
Time per request: 341.414 [ms] (mean)
Time per request: 0.341 [ms] (mean, across all concurrent requests)
Transfer rate: 1332.92 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 23 41 9.9 42 57
Processing: 78 177 65.4 178 274
Waiting: 72 176 65.4 177 274
Total: 120 218 72.0 234 316 Percentage of the requests served within a certain time (ms)
50% 234
66% 278
75% 288
80% 294
90% 307
95% 312
98% 315
99% 316
100% 316 (longest request)
[root@idc_web~]#

參考文章地址:http://blog.csdn.net/chenxiaohua/article/details/2047757

參考文章地址:http://blog.chinaunix.net/uid-7411781-id-2056132.html

參考文章:http://www.cnblogs.com/shipengzhi/archive/2012/10/09/2716766.html

版权声明:本文博客原创文章,博客,未经同意,不得转载。

云server 性能测试web压力测试的更多相关文章

  1. web压力测试工具(小而精)

    实际的测试过程中,我们一般都是采用A.B两台机器,一台跑Web服务,另外一台跑ab测试.也有的情况是单机对单机可能测不出结果,那就要采用很多台机器同是跑AB去请求一台机器进行测试,根据多台机器反馈的结 ...

  2. WEB压力测试工具Pylot试用

    Pylot介绍 转载自[http://www.freehao123.com/pylot-web/] 为了能够准确地评估网站服务器对网络流量的承受能力,我们一般会采取模拟网站用户访问,通过不断地增加并发 ...

  3. 分享一个.NET实现的简单高效WEB压力测试工具

    在Linux下对Web进行压力测试的小工具有很多,比较出名的有AB.虽然AB可以运行在windows下,但对于想简单界面操作的朋友有点不太习惯.其实vs.net也提供压力测试功能但显然显得太重了,在测 ...

  4. WEB压力测试

    原文地址:WEB压力测试 作者:鸟哥のlinux webbench最多可以模拟3万个并发连接去测试网站的负载能力,个人感觉要比Apache自带的ab压力测试工具好,安装使用也特别方便. 1.适用系统: ...

  5. web压力测试工具

    ab apache 自带的web压力测试工具,window和linux下均有. 命令行:./ab -c 100 -n 1000 http://www.baidu.com 说明: -c 表示同时处理10 ...

  6. 推荐一个linux下的web压力测试工具神器webbench

    推荐一个linux下的web压力测试工具神器webbench2014-04-30 09:35:29   来源:   评论:0 点击:880 用多了apache的ab工具之后你就会发现ab存在很多问题, ...

  7. python的web压力测试工具-pylot安装使用

    http://blog.csdn.net/chenggong2dm/article/details/10106517 pylot是python编写的一款web压力测试工具.使用比较简单.而且测试结果相 ...

  8. [转贴]LTP--linux稳定性测试 linux性能测试 ltp压力测试 ---IBM 的 linux test project

    https://blog.csdn.net/melody157398/article/details/24354415   LTP--linux稳定性测试 linux性能测试 ltp压力测试 ---I ...

  9. LTP--linux稳定性测试 linux性能测试 ltp压力测试 ---IBM 的 linux test project

    LTP--linux稳定性测试 linux性能测试 ltp压力测试 ---IBM 的 linux test project Peter盼 2014-04-23 11:25:49  20302  收藏  ...

随机推荐

  1. jQuery EasyUI实现全部关闭tabs

    有时,当我们打开很多tabs当标签,要关闭一个接一个,它只能被关停 显然太麻烦,能够在选项卡的最右边加入一个button 实现关闭所有. 代码例如以下: <!DOCTYPE HTML PUBLI ...

  2. Linux网络基础设施配置

    1.TCP/IP网络配置文件 /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network /etc/host.conf /etc/ ...

  3. 人迹罕至的android要完全退出程序的一种方法

    最近的一个项目,无意中发现了一个方法,使android要完全退出程序的一种方法,遥想当年,以便找到让的有效途径android遇险完全退出程序,我不由得有些感慨. 在这里,不敢独享.和大家分享一下,还启 ...

  4. 命令模式 & 策略模式 & 模板方法

    一.策略模式 策略模式:封装易变化的算法,可互相替换. GoF<设计模式>中说道:定义一系列算法,把它们一个个封装起来,并且使它们可以相互替换.该模式使得算法可独立于它们的客户变化. 比如 ...

  5. 数组名取地址所算数运算应注意的&quot;trap&quot;

    数组名取地址所算数运算应注意的"trap" 直接看代码: #include <stdio.h> int main() { int array[5]; printf(&q ...

  6. 操作系统学习笔记_12_I/O管理 --I/O管理概述

    h1 { margin-bottom: 0.21cm; }h1.western { font-family: "Liberation Sans",sans-serif; font- ...

  7. MVC把随机产生的字符串转换为图片

    原文:MVC把随机产生的字符串转换为图片 Insus.NET在这篇中<在ASP.NET MVC应用程序中随机获取一个字符串>http://www.cnblogs.com/insus/p/3 ...

  8. (大数据工程师学习路径)第五步 MySQL参考手册中文版----MySQL数据库管理

    一.MySQL权限管理 账户权限信息被存储在mysql数据库的user.db.host.tables_priv.columns_priv和procs_priv表中. GRANT和REVOKE语句所用的 ...

  9. CocoaChina 第四个测试

    1. iOS同意近期本地通知数量最大为多少? A.64 B.32 C.128 D.16 2. int x = 1; int y = 2; int z = x^y*y; NSLog(@"%d& ...

  10. git 配置多个SSH-Key(转)

    摘要 我们在日常工作中会遇到公司有个gitlab,还有些自己的一些项目放在github上.这样就导致我们要配置不同的ssh-key对应不同的环境. 目录[-] 1,生成一个公司用的SSH-Key 2, ...