[ACCEPTED]-Failed requests by length in my ApacheBench load test result-apachebench
Run ab
with the -v 2
parameter, meaning verbosity 14 level 2. This will dump the response headers. If 13 your requests are not using chunked encoding, you 12 will see a "Content-Length" header indicating 11 the size of each response.
gw:~$ ab -n 1 -v 2 "http://whatever.com/"
...
LOG: header received:
HTTP/1.0 200 OK
...
Content-Length: 1568399
If your responses 10 use chunked encoding, then the length is 9 not known until the transfer ends. Usually 8 chunked encoding is only used for compressed 7 responses, and ApacheBench doesn't do compression 6 by default.
If it is compressing the responses 5 for whatever reason that might explain it; the 4 compressed length depends on the content.
You 3 can also use curl -i
and the --compress
option to see the 2 response headers to a single request with 1 and without compression.
Use tcpdump
Open qty 2 terminal/shell windows or just 8 use screen.
In the first window, use tcpdump 7 to capture transmission data from/to your 6 NIC (eth0) to a file:
sudo tcpdump -s 9999 -i eth0 -w myfile.txt
In the second window, fire 5 off your ab command:
ab -n 500 -c 200 http://domain.com/test/index.php
When that's all done, parse 4 the file with strings and grep:
strings myfile2.txt | grep -C 3 "200 OK"
You should 3 be able to monitor all the data segments 2 from there by eyeballing or grep'ing the 1 results.
ab assumes that all responses are the same. It 6 looks at the content-length of the first 5 response, and then compares others to that.
From 4 the man page:
Document Length
This is the size in bytes of the first successfully returned document.
If the document length changes during testing, the response is
considered an error.
So if your first request contains 3 following data:
{"hostname":"nodecellar-1-dwfxd","serverip":"10.1.3.3"}
And the next one is:
{"hostname":"nodecellar-1-dwfxd","serverip":"10.1.3.30"}
ab will 2 fail with a Length error, since the output 1 is one character longer.
This is an issue with dynamic pages, it 3 happens because the Content-Length
HTTP header can vary 2 between the requests. When using ab
with such 1 pages you need to use the -l
option.
-l Accept variable document length (use this for dynamic pages)
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.