我需要测试一个上传文件的Web表单.每次上传的文件大小约为10 MB.我想测试服务器是否可以处理超过100个同时上传,并且仍然对网站的其余部分保持响应.
我们办公室提交的重复表格将受到我们当地DSL线路的限制.服务器位于异地,带宽较高.
基于经验的答案会很棒,但欢迎任何建议.
使用与Apache捆绑的ab(ApacheBench)命令行工具(我刚刚发现了这个很棒的小工具).与cURL或wget不同,ApacheBench设计用于在Web服务器(任何类型的Web服务器!)上执行压力测试.它也会产生大量的统计数据 下面的命令将发送HTTP POST请求包括文件test.jpg
到http://localhost/
100倍,最多4名并行的请求.
ab -n 100 -c 4 -p test.jpg http://localhost/
它产生如下输出:
Server Software: Server Hostname: localhost Server Port: 80 Document Path: / Document Length: 0 bytes Concurrency Level: 4 Time taken for tests: 0.78125 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Non-2xx responses: 100 Total transferred: 2600 bytes HTML transferred: 0 bytes Requests per second: 1280.00 [#/sec] (mean) Time per request: 3.125 [ms] (mean) Time per request: 0.781 [ms] (mean, across all concurrent requests) Transfer rate: 25.60 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 2.6 0 15 Processing: 0 2 5.5 0 15 Waiting: 0 1 4.8 0 15 Total: 0 2 6.0 0 15 Percentage of the requests served within a certain time (ms) 50% 0 66% 0 75% 0 80% 0 90% 15 95% 15 98% 15 99% 15 100% 15 (longest request)