tomcat(5)性能测试

1、说明

采用ab测试工具,10000个请求并发数100访问tomcat根目录。测试命令:

1
ab -n 10000 -c 100 http://127.0.0.1:8080/

tomcat默认参数-Xms512m -Xmx1024m,线程池模式下参数maxThreads="500" minSpareThreads="100"

2、无线程池测试

2.1、bio

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Concurrency Level:      100
Time taken for tests: 2.664 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 113430000 bytes
HTML transferred: 111970000 bytes
Requests per second: 3754.20 [#/sec] (mean)
Time per request: 26.637 [ms] (mean)
Time per request: 0.266 [ms] (mean, across all concurrent requests)
Transfer rate: 41585.85 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.6 1 4
Processing: 4 25 9.4 21 146
Waiting: 2 23 8.6 19 117
Total: 6 26 9.3 23 146

Percentage of the requests served within a certain time (ms)
50% 23
66% 30
75% 31
80% 32
90% 35
95% 42
98% 51
99% 60
100% 146 (longest request)

2.2、nio

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Concurrency Level:      100
Time taken for tests: 2.375 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 113430000 bytes
HTML transferred: 111970000 bytes
Requests per second: 4211.00 [#/sec] (mean)
Time per request: 23.747 [ms] (mean)
Time per request: 0.237 [ms] (mean, across all concurrent requests)
Transfer rate: 46645.85 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.5 1 3
Processing: 3 22 9.1 18 128
Waiting: 2 21 8.7 16 126
Total: 3 24 9.1 19 129

Percentage of the requests served within a certain time (ms)
50% 19
66% 27
75% 29
80% 30
90% 33
95% 41
98% 49
99% 53
100% 129 (longest request)

2.3、apr

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Concurrency Level:      100
Time taken for tests: 2.102 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 113430000 bytes
HTML transferred: 111970000 bytes
Requests per second: 4757.18 [#/sec] (mean)
Time per request: 21.021 [ms] (mean)
Time per request: 0.210 [ms] (mean, across all concurrent requests)
Transfer rate: 52695.96 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.3 1 2
Processing: 2 20 8.5 15 126
Waiting: 1 17 7.2 14 125
Total: 3 21 8.4 17 126

Percentage of the requests served within a certain time (ms)
50% 17
66% 25
75% 26
80% 26
90% 30
95% 34
98% 40
99% 53
100% 126 (longest request)

3、有线程池测试

3.1、bio

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Concurrency Level:      100
Time taken for tests: 2.593 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 113430000 bytes
HTML transferred: 111970000 bytes
Requests per second: 3856.82 [#/sec] (mean)
Time per request: 25.928 [ms] (mean)
Time per request: 0.259 [ms] (mean, across all concurrent requests)
Transfer rate: 42722.58 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.5 1 4
Processing: 4 24 9.2 22 148
Waiting: 1 23 8.6 20 133
Total: 4 26 9.1 23 148

Percentage of the requests served within a certain time (ms)
50% 23
66% 29
75% 30
80% 31
90% 38
95% 41
98% 47
99% 56
100% 148 (longest request)

3.2、nio

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Concurrency Level:      100
Time taken for tests: 2.449 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 113430000 bytes
HTML transferred: 111970000 bytes
Requests per second: 4083.13 [#/sec] (mean)
Time per request: 24.491 [ms] (mean)
Time per request: 0.245 [ms] (mean, across all concurrent requests)
Transfer rate: 45229.41 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.5 1 4
Processing: 0 23 8.3 20 117
Waiting: 0 21 7.6 18 113
Total: 0 24 8.5 21 118

Percentage of the requests served within a certain time (ms)
50% 21
66% 28
75% 29
80% 30
90% 32
95% 37
98% 47
99% 50
100% 118 (longest request)

3.3、apr

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Concurrency Level:      100
Time taken for tests: 2.026 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 113430000 bytes
HTML transferred: 111970000 bytes
Requests per second: 4936.83 [#/sec] (mean)
Time per request: 20.256 [ms] (mean)
Time per request: 0.203 [ms] (mean, across all concurrent requests)
Transfer rate: 54686.01 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.3 1 3
Processing: 6 19 8.4 15 143
Waiting: 3 17 6.7 14 132
Total: 6 20 8.4 16 143

Percentage of the requests served within a certain time (ms)
50% 16
66% 19
75% 26
80% 27
90% 28
95% 29
98% 41
99% 43
100% 143 (longest request)

4、总结

模式 有无线程池 总耗时
bio 2.664
bio 2.593
nio 2.375
nio 2.449
apr 2.102
apr 2.026