Apache ab测试工作用法看你的apache每秒处理多少请求

windows 下先运行cmd 然后 输入apache的bin目录 然后执行 ab -n1000 -c10 http://www.qq.com/

比如我的是这样的

我的apache目录是在
G:/APMServ5.2.6/Apache/bin/

下面是执行步骤
在XP上 =》 开始 =》 运行 =》 cmd 回车 => g: 回车  => cd APMServ5.2.6/Apache/bin/ 回车 =》
ab -n100 -c10 http://localhost/



首先介绍apache ab(Apache Bench)性能测试工具,这是apache免费自带的性能测试工具,就在apache的bin目录下,它能模拟多个并发请求,也就是说它主要是用来测试你的apache每秒能处理多少请求的。

格式:ab [options] [http://]hostname[:port]/path

参数选项:

-A auth-username:password 
对服务器提供BASIC认证信任。 用户名和密码由一个:隔开,并以base64编码形式发送。 无论服务器是否需要(即, 是否发送了401认证需求代码),此字符串都会被发送。 
-c concurrency 
一次产生的请求个数。默认是一次一个。 
-C cookie-name=value 
对请求附加一个Cookie:行。 其典型形式是name=value的一个参数对。 此参数可以重复。 
-d 
不显示"percentage served within XX [ms] table"的消息(为以前的版本提供支持)。 
-e csv-file 
产生一个以逗号分隔的(CSV)文件, 其中包含了处理每个相应百分比的请求所需要(从1%到100%)的相应百分比的(以微妙为单位)时间。 由于这种格式已经“二进制化”,所以比'gnuplot'格式更有用。 
-g gnuplot-file 
把所有测试结果写入一个'gnuplot'或者TSV (以Tab分隔的)文件。 此文件可以方便地导入到Gnuplot, IDL, Mathematica, Igor甚至Excel中。 其中的第一行为标题。 
-h 
显示使用方法。 
-H custom-header 
对请求附加额外的头信息。 此参数的典型形式是一个有效的头信息行,其中包含了以冒号分隔的字段和值的对 (如, "Accept-Encoding: zip/zop;8bit"). 
-i 
执行HEAD请求,而不是GET。 
-k 
启用HTTP KeepAlive功能,即, 在一个HTTP会话中执行多个请求。 默认时,不启用KeepAlive功能. 
-n requests 
在测试会话中所执行的请求个数。 默认时,仅执行一个请求,但通常其结果不具有代表意义。 
-p POST-file 
包含了需要POST的数据的文件. 
-P proxy-auth-username:password 
对一个中转代理提供BASIC认证信任。 用户名和密码由一个:隔开,并以base64编码形式发送。 无论服务器是否需要(即, 是否发送了401认证需求代码),此字符串都会被发送。 
-q 
如果处理的请求数大于150, ab每处理大约10%或者100个请求时,会在stderr输出一个进度计数。 此-q标记可以抑制这些信息。 
-s 
用于编译中(ab -h会显示相关信息)使用了SSL的受保护的https, 而不是http协议的时候。此功能是实验性的,也是很简陋的。最好不要用。 
-S 
不显示中值和标准背离值, 而且在均值和中值为标准背离值的1到2倍时,也不显示警告或出错信息。 默认时,会显示 最小值/均值/最大值等数值。(为以前的版本提供支持). 
-t timelimit 
测试所进行的最大秒数。其内部隐含值是-n 50000。 它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。 
-T content-type 
POST数据所使用的Content-type头信息。 
-v verbosity 
设置显示信息的详细程度 - 4或更大值会显示头信息, 3或更大值可以显示响应代码(404, 200等), 2或更大值可以显示警告和其他信息。 
-V 
显示版本号并退出。 
-w 
以HTML表的格式输出结果。默认时,它是白色背景的两列宽度的一张表。 
-x <table>-attributes 
设置<table>属性的字符串。 此属性被填入<table 这里 >. 
-X proxy[:port] 
对请求使用代理服务器。 
-y <tr>-attributes 
设置<tr>属性的字符串. 
-z <td>-attributes 
设置<td>属性的字符串

这么多参数,其实你大可不必担心,最基本的关心两个选项 -c -n

例:ab -c 100 -n 10000 http://www.baidu.com/

-c 100 即:每次并发100个
-n 10000 即: 共发送10000个请求

 

唉,无限网速太慢了,没法登录ssh,只能在windows apache下测试了,但是要注意

(1).测试的url后面要带上/。

(2).“-n”表示:每次请求数,默认不能超过1024个,否则需要修改系统进程限制。
(3).“-c”表示:1个请求的并发连接数,默认最大不能超过50000。






  1.  
  2. //apache的版本信息
  3. Server Software:Apache/2.2.3
  4. //服务器主机名
  5. Server Hostname: localhost
  6. //服务器断开
  7. Server Port:80
  8. //测试页面路径
  9. Document Path:/
  10. //文档大小
  11. Document Length:37826 bytes
  12. //并发数
  13. ConcurrencyLevel:10
  14. //测试持续时间
  15. Time takenfor tests:27.318 seconds
  16. //完成请求数量
  17. Complete requests:20
  18. //失败请求数量
  19. Failed requests:0
  20. //写入失败数量
  21. Write errors:0
  22. //网络传输总量
  23. Total transferred:765280 bytes
  24. //html内容传输量
  25. HTML transferred:756520 bytes
  26. //平均每秒事务数
  27. Requests per second:0.73[#/sec] (mean)
  28. //平均事务响应时间
  29. Time per request:13658.781[ms](mean)
  30. //每个请求实际运行时间平均值
  31. Time per request:1365.878[ms](mean, across all concurrent requests)
  32. //平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题
  33. Transfer rate:27.36[Kbytes/sec] received
  34. //网络上消耗的时间的分解
  35. ConnectionTimes(ms)
  36. min mean[+/-sd] median max
  37. Connect:26512181399.53463348
  38. Processing:260299573945.7903314973
  39. Waiting:79668683409.0763111692
  40. Total:3204111753709.01055818175
  41. //下面是请求状况
  42. Percentage of the requests served within a certain time(ms)
  43. 50%10558//50%的童鞋在打开localhost响应时间小于10558毫秒,下面解释同理
  44. 66%13916
  45. 75%14557
  46. 80%14938
  47. 90%15311
  48. 95%18175
  49. 98%18175
  50. 99%18175
  51. 100%18175(longest request)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
About This Book Explore the integration of Apache Spark with third party applications such as H20, Databricks and Titan Evaluate how Cassandra and Hbase can be used for storage An advanced guide with a combination of instructions and practical examples to extend the most up-to date Spark functionalities Who This Book Is For If you are a developer with some experience with Spark and want to strengthen your knowledge of how to get around in the world of Spark, then this book is ideal for you. Basic knowledge of Linux, Hadoop and Spark is assumed. Reasonable knowledge of Scala is expected. What You Will Learn Extend the tools available for processing and storage Examine clustering and classification using MLlib Discover Spark stream processing via Flume, HDFS Create a schema in Spark SQL, and learn how a Spark schema can be populated with data Study Spark based graph processing using Spark GraphX Combine Spark with H20 and deep learning and learn why it is useful Evaluate how graph storage works with Apache Spark, Titan, HBase and Cassandra Use Apache Spark in the cloud with Databricks and AWS In Detail Apache Spark is an in-memory cluster based parallel processing system that provides a wide range of functionality like graph processing, machine learning, stream processing and SQL. It operates at unprecedented speeds, is easy to use and offers a rich set of data transformations. This book aims to take your limited knowledge of Spark to the next level by teaching you how to expand Spark functionality. The book commences with an overview of the Spark eco-system. You will learn how to use MLlib to create a fully working neural net for handwriting recognition. You will then discover how stream processing can be tuned for optimal performance and to ensure parallel processing. The book extends to show how to incorporate H20 for machine learning, Titan for graph based storage, Databricks for cloud-based Spark. Intermediate Scala based code examples are provided for Apache Spark module processing in a CentOS Linux and Databricks cloud environment. Table of Contents Chapter 1: Apache Spark Chapter 2: Apache Spark Mllib Chapter 3: Apache Spark Streaming Chapter 4: Apache Spark Sql Chapter 5: Apache Spark Graphx Chapter 6: Graph-Based Storage Chapter 7: Extending Spark With H2O Chapter 8: Spark Databricks Chapter 9: Databricks Visualization

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值