设为首页 收藏本站
查看: 595|回复: 0

[经验分享] Netty 性能测试(与Tomcat 对比)

[复制链接]

尚未签到

发表于 2017-2-1 08:16:05 | 显示全部楼层 |阅读模式
一直以来都认为 Netty 的性能会非常优秀,打算在适当的时候使用它来开发一些要求超高新能的服务。
今天兴致勃勃的写了个简单的 HTTP 服务,同样也用 tomcat 写了一个对比的 jsp 页面。结果测试下来,感觉 Netty 的性能提升并不显著。Netty 中采用的是 NIO 模式。Tomcat 采用了缺省配置。
看来采用 Netty 还要再慎重测试一下。当然这个测试结果也不是特别的严谨。这个结论不是最终结论。
Netty 测试结果

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)


Tomcat 测试结果

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)



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)
[iyunv@centos ~]# 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)

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-335937-1-1.html 上篇帖子: Tomcat下使用ssl实现双向认证 下篇帖子: Tomcat 项目迁移至weblogic 10笔记()
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表