为了我自己的好奇心做一些负载测试,在我的服务器上运行:
ab -kc 50 -t 200 http://localhost/index.php
Run Code Online (Sandbox Code Playgroud)
这将打开50个保持活动连接200秒,然后使用index.php请求猛烈抨击我的服务器
在我的结果中,我得到:
Concurrency Level: 50
Time taken for tests: 200.007 seconds
Complete requests: 33106
Failed requests: 32951
(Connect: 0, Receive: 0, Length: 32951, Exceptions: 0)
Write errors: 0
Keep-Alive requests: 0
Total transferred: 1948268960 bytes
HTML transferred: 1938001392 bytes
Requests per second: 165.52 [#/sec] (mean)
Time per request: 302.071 [ms] (mean)
Time per request: 6.041 [ms] (mean, across all concurrent requests)
Transfer rate: 9512.69 [Kbytes/sec] received
Run Code Online (Sandbox Code Playgroud)
请注意32951"失败"请求.我无法弄清楚这一点.
在测试运行时,我能够完美地从家用计算机访问我的网站,尽管页面底部的页面加载时间报告为.5而不是通常的.02.但是我从来没有遇到过失败的请求.
那么为什么AB报告说有一半的连接失败了?"长度:"在这种情况下意味着什么?
谢谢
我想在Windows上安装Apache Bench,有人能告诉我哪些MSI可以获得吗?
我确实安装了一些MSI,但似乎已经安装了apache http服务器.
我只需要运行Apache Bench,因为我正在测试IIS asp.net应用程序.
我正在测试eventlet,我收到此错误:
~>ab -n 10 -c 1 http://localhost:8090/
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 localhost (be patient)...apr_socket_recv: Connection reset by peer (54)
Total of 2 requests completed
Run Code Online (Sandbox Code Playgroud)
该网站在localhost:8090 /工作,并返回200 OK.
我和tomcat有同样的问题,网站再次运行良好.
问题可能是什么?
我正在从Windows 7/SP1客户端加载测试IIS 7.5(WinR2/SP1).我有一个脚本,可以进行三次ab
调用:
start /B cmd /c ab.exe -k -n 500 -c 50 http://rhvwr2vsu410/HelloWebAPI/Home/SyncProducts > SyncProducts.txt
Run Code Online (Sandbox Code Playgroud)
当并发度大于5时,我很快就会收到错误消息
apr_poll:指定的超时已过期(70007)
并ab
停止提出请求.我甚至没有完成100个请求.
这是在启动脚本后的30秒内发生的.在AB文档页面没有提供太多.相关的Stack Overflow问题.服务器故障相关问题.
我刚才开始使用AB.阅读关于新的AB教程的几个想法尝试加载测试我的网站.
使用它几次后我得到了大量失败的请求.你能解释失败的请求是什么意思吗?如何针对此问题进行更多调查?
样本AB结果:
-jailshell-3.2$ ab -n500 -c10 http://www.tweeting.tv/index.php
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.tweeting.tv (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 500 requests
Server Software: Apache
Server Hostname: www.tweeting.tv
Server Port: 80
Document Path: /index.php
Document Length: 242861 bytes
Concurrency Level: 10
Time taken for tests: 97.846330 seconds
Complete requests: 500
Failed …
Run Code Online (Sandbox Code Playgroud) 我开始在JMeter中编写一些基本测试,并且惊讶于测量结果与Apache ab的测量结果非常不同.
我有一个千兆局域网连接运行Nginx的Intel i7服务器和运行JMeter或ab的i5测试机.最初,我只是测试开箱即用的Nginx主页响应率.
ab -c 1 -n 100 http://testserver.local/
Run Code Online (Sandbox Code Playgroud)
给
Document Path: /
Document Length: 151 bytes
Concurrency Level: 1
Time taken for tests: 0.078 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 38400 bytes
HTML transferred: 15100 bytes
Requests per second: 1280.77 [#/sec] (mean)
Time per request: 0.781 [ms] (mean)
Time per request: 0.781 [ms] (mean, across all concurrent requests)
Transfer rate: 480.29 [Kbytes/sec] received
Run Code Online (Sandbox Code Playgroud)
该结果始终可重复,+/ - 百分之几.
在JMeter中,我有一个1用户的100循环线程组,其中包含:
只有100个样本,每次运行时都会产生非常不一致的结果.但最令人吃惊的事实是报告吞吐量低至每秒40个请求(而不是1280).最高记录率为1030,这仅在我增加到10,000个样本时才实现. …
每当我使用'ab'对Web服务器进行基准测试时,它会在发送大量请求后冻结一段时间,但仅在20秒左右后继续.
考虑以下用Ruby编写的HTTP服务器模拟器:
require 'socket'
RESPONSE = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"\r\n" +
"\r\n"
buffer = ""
server = TCPServer.new("127.0.0.1", 3000) # Create TCP server at port 3000.
server.listen(1024) # Set backlog to 1024.
while true
client = server.accept # Accept new client.
client.write(RESPONSE) # Write a stock "HTTP" response.
client.close_write # Shutdown write part of the socket.
client.read(nil, buffer) # Read all data from the socket.
client.close # Close it.
end
Run Code Online (Sandbox Code Playgroud)
然后我按如下方式运行ab:
ab -n 45000 -c 10 …
Run Code Online (Sandbox Code Playgroud) 这两个字段有什么区别?:
他们每个人的计算方式如何?
样本输出:
Time per request: 3953.446 [ms] (mean)
Time per request: 39.534 [ms] (mean, across all concurrent requests)
Run Code Online (Sandbox Code Playgroud)
为什么会有很大差异?
我试图ab测试旋风.
我跑的时候
ab -n 2000 -c 25 http://127.0.0.1
Run Code Online (Sandbox Code Playgroud)
我得到ab:无效的网址.
嗯......当我在我的开发机器上去ff时,网站就在那里.
这是我的nginx配置
http {
upstream frontends {
server 127.0.0.1:8051;
}
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 30;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Only retry if there was a communication error, not a timeout
# on the Tornado server (to avoid propagating "queries of death"
# to all frontends)
proxy_next_upstream error;
server {
listen 80; …
Run Code Online (Sandbox Code Playgroud) 我需要传递多个标头Apache benchmark
.
我搜索过SO并用google搜索,但到目前为止还没有运气.
ab -n200 -c100 -H 'clientId:test-client;token:93e6acff-2ef9-4c85-9d0b-c9948a8ee93b' http://127.0.0.1/oauth2/user/client/
Run Code Online (Sandbox Code Playgroud) apachebench ×10
benchmarking ×2
apache ×1
cyclone ×1
debugging ×1
header ×1
jmeter ×1
load ×1
load-testing ×1
networking ×1
nginx ×1
rest ×1
sockets ×1
testing ×1
throttling ×1