这个话题可能有点老了,但是我没有找到具体的答案,所以再拿出了讨论下。
看了robbin轻松并发1000,我却怎么都搞不起来,很是疑惑,望有经验的同仁指点。
服务器配置:
操作系统:Red Hat Enterprise 5 64位
CPU: 2颗4核Intel(R) Xeon(R) CPU E5410 @ 2.33GHz 64位
内存: 8G
Tomcat : 6.0.18
Tomcat配置:
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="1000" minSpareThreads="25" /> <Connector port="80" executor="tomcatThreadPool" protocol="HTTP/1.1" redirectPort="443" connectionTimeout="20000" maxThreads="1000" acceptCount="250" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" disableUploadTimeout="true" URIEncoding="UTF-8"/>
我在自己电脑上测服务器并发
C:\Program Files\Apache Group\Apache2\bin>ab -n 1000 -c 60 http://www.mytomcat.cn/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.mytomcat.cn (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
Finished 1000 requests
Server Software: Apache-Coyote/1.1
Server Hostname: www.mytomcat.cn
Server Port: 80
Document Path: /
Document Length: 154468 bytes
Concurrency Level: 60
Time taken for tests: 134.593750 seconds
Complete requests: 1000
Failed requests: 3
(Connect: 3, Length: 0, Exceptions: 0)
Write errors: 0
Total transferred: 154674000 bytes
HTML transferred: 154468000 bytes
Requests per second: 7.43 [#/sec] (mean)
Time per request: 8075.625 [ms] (mean)
Time per request: 134.594 [ms] (mean, across all concurrent requests)
Transfer rate: 1122.25 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 68 699.4 15 9046
Processing: 31 7919 12149.5 844 51813
Waiting: 0 3764 9156.9 328 30656
Total: 46 7988 12189.6 859 51828
Percentage of the requests served within a certain time (ms)
50% 859
66% 906
75% 12703
80% 24750
90% 30781
95% 30812
98% 33656
99% 33718
100% 51828 (longest request)
C:\Program Files\Apache Group\Apache2\bin>ab -n 1000 -c 70 http://www.mytomcat.cn/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.mytomcat.cn (be patient)
apr_pollset_create failed: Invalid argument (22)
才并发70就不行了,maxThreads , acceptCount, minSpareThreads,maxSpareThreads这几个参数怎么样设置为最佳,欢迎来拍砖