以下是一台阿里云机器,跑的测试结果,有知道这样的结果能反映什么问题吗?
目前小弟遇到一个性能问题,单人操作的时候速度还行,但是20 人左右同时操作的时候,就感觉很慢了。
[root@AY1311281530504461fdZ bin]# ./ab -n 1000 -c 700 localhost/test.jsp
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustec h.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.tdaijia.net (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-Coyote/1.1
Server Hostname: localhost
Server Port: 80
Document Path: /driver/list.jsp
Document Length: 6026 bytes
Concurrency Level: 700
Time taken for tests: 25.032 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 6287000 bytes
HTML transferred: 6026000 bytes
Requests per second: 39.95 #/sec
Time per request: 17522.387 ms
Time per request: 25.032 ms
Transfer rate: 245.27 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 15 11.4 17 33
Processing: 15 9499 9491.1 7964 25000
Waiting: 15 9499 9491.1 7964 25000
Total: 19 9514 9500.1 7991 25031
Percentage of the requests served within a certain time (ms)
50% 7991
66% 8915
75% 21802
80% 21985
90% 24811
95% 24943
98% 25004
99% 25018
100% 25031 (longest request)
有本书《构建高性能WEB站点》,具体讲到了使用AB来测试响应的情况,里面有对应的分析,以及使用页面缓存等情况下对响应的影响。推荐楼主看看。
并发操作时速度下降是很正常的,如果数据库操作频繁的话最好优化一下,尽量少去数据库取数据。
也可以考虑将一些访问量大的动态页面静态化,不过这并不适合所有情况,只能说具体情况还得具体分析啊。。