Netty 性能测试(与Tomcat 对比)

一直以来都认为 Netty 的性能会非常优秀,打算在适当的时候使用它来开发一些要求超高新能的服务。

今天兴致勃勃的写了个简单的 HTTP 服务,同样也用 tomcat 写了一个对比的 jsp 页面。结果测试下来,感觉 Netty 的性能提升并不显著。Netty 中采用的是 NIO 模式。Tomcat 采用了缺省配置。

看来采用 Netty 还要再慎重测试一下。当然这个测试结果也不是特别的严谨。这个结论不是最终结论。

[b]Netty 测试结果[/b]


ab -n 10000 -c 10 http://192.168.1.237:8080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.237 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software:
Server Hostname: 192.168.1.237
Server Port: 8080

Document Path: /
Document Length: 151 bytes

Concurrency Level: 10
Time taken for tests: 5.641704 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2110000 bytes
HTML transferred: 1510000 bytes
Requests per second: 1772.51 [#/sec] (mean)
Time per request: 5.642 [ms] (mean)
Time per request: 0.564 [ms] (mean, across all concurrent requests)
Transfer rate: 365.14 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.4 0 23
Processing: 1 4 2.1 4 37
Waiting: 0 3 1.9 3 26
Total: 2 4 2.7 5 38

Percentage of the requests served within a certain time (ms)
50% 5
66% 5
75% 5
80% 6
90% 6
95% 8
98% 12
99% 16
100% 38 (longest request)



ab -k -n 10000 -c 10 http://192.168.1.237:8080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.237 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software:
Server Hostname: 192.168.1.237
Server Port: 8080

Document Path: /
Document Length: 151 bytes

Concurrency Level: 10
Time taken for tests: 1.546421 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 10000
Total transferred: 2560768 bytes
HTML transferred: 1510453 bytes
Requests per second: 6466.54 [#/sec] (mean)
Time per request: 1.546 [ms] (mean)
Time per request: 0.155 [ms] (mean, across all concurrent requests)
Transfer rate: 1616.64 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 3
Processing: 0 1 1.9 1 37
Waiting: 0 0 2.1 1 37
Total: 0 1 1.9 1 38

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 2
95% 2
98% 5
99% 10
100% 38 (longest request)


[b]Tomcat 测试结果[/b]

ab -n 10000 -c 10 http://192.168.1.237:8080/TestWeb/a.jsp
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.237 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: Apache-Coyote/1.1
Server Hostname: 192.168.1.237
Server Port: 8080

Document Path: /TestWeb/a.jsp
Document Length: 151 bytes

Concurrency Level: 10
Time taken for tests: 5.767970 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 3900000 bytes
HTML transferred: 1510000 bytes
Requests per second: 1733.71 [#/sec] (mean)
Time per request: 5.768 [ms] (mean)
Time per request: 0.577 [ms] (mean, across all concurrent requests)
Transfer rate: 660.20 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.3 1 19
Processing: 0 4 8.8 3 174
Waiting: 0 3 8.6 2 173
Total: 1 5 8.9 4 174

Percentage of the requests served within a certain time (ms)
50% 4
66% 4
75% 5
80% 5
90% 8
95% 10
98% 16
99% 26
100% 174 (longest request)



[code="java"]
ab -k -n 10000 -c 10 http://192.168.1.237:8080/TestWeb/a.jsp
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.237 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: Apache-Coyote/1.1
Server Hostname: 192.168.1.237
Server Port: 8080

Document Path: /TestWeb/a.jsp
Document Length: 151 bytes

Concurrency Level: 10
Time taken for tests: 2.93494 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 9904
Total transferred: 3949520 bytes
HTML transferred: 1510000 bytes
Requests per second: 4776.70 [#/sec] (mean)
Time per request: 2.093 [ms] (mean)
Time per request: 0.209 [ms] (mean, across all concurrent requests)
Transfer rate: 1841.90 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 4
Processing: 0 1 7.4 1 232
Waiting: 0 1 7.4 1 232
Total: 0 1 7.4 1 232

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 2
80% 2
90% 3
95% 4
98% 8
99% 12
100% 232 (longest request)
# ab -k -n 10000 -c 10 http://192.168.1.237:8080/TestWeb/a.jsp
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.237 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software: Apache-Coyote/1.1
Server Hostname: 192.168.1.237
Server Port: 8080

Document Path: /TestWeb/a.jsp
Document Length: 151 bytes

Concurrency Level: 10
Time taken for tests: 2.179860 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 9904
Total transferred: 3950705 bytes
HTML transferred: 1510453 bytes
Requests per second: 4587.45 [#/sec] (mean)
Time per request: 2.180 [ms] (mean)
Time per request: 0.218 [ms] (mean, across all concurrent requests)
Transfer rate: 1769.84 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 8
Processing: 0 1 10.5 1 329
Waiting: 0 1 10.5 1 329
Total: 0 1 10.5 1 329

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 2
80% 2
90% 3
95% 4
98% 7
99% 13
100% 329 (longest request)
[/code]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值