一直以来都认为 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)
[root@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)
分享到:
相关推荐
在“Netty性能测试”中,我们关注的是Netty在处理并发请求时的能力,以及它作为RPC(远程过程调用)框架的表现。 Netty 的高性能主要体现在以下几个方面: 1. **异步IO模型**:Netty采用了NIO(非阻塞I/O)模型,...
### Netty与Tomcat功能比较 #### 一、概述 Netty和Tomcat都是Java领域内非常著名的服务器框架,但它们的设计目标和技术实现路径存在显著差异。本文将深入探讨Netty与Tomcat之间的区别,以及Netty之所以备受青睐的...
与Tomcat相比,Jetty的启动速度更快,内存占用更少,对于小型和嵌入式项目特别适用。Jetty对WebSocket的支持非常全面,它实现了WebSocket API,使得开发者可以方便地在Jetty服务器上构建WebSocket应用。 Netty则是...
Netty性能测试报告主要对比了Resin服务器与Netty服务器在处理HTTP请求时的性能表现。测试采用了"echo server"的方式,即将接收到的POST请求数据原样返回给客户端,以此来评估服务器处理请求的能力。测试环境配置为8...
《Netty性能测试报告》 本测试报告主要探讨了Netty框架与Resin服务器在处理HTTP请求时的性能差异,采用了一种公平的比较方法,即通过“echo server”模式,将接收到的POST请求数据原样返回。测试中,我们针对不同...
1. **Netty**: Netty是一个异步事件驱动的网络应用框架,用于快速开发可维护的高性能协议服务器和客户端。它提供了一个高度灵活的、高性能的NIO库,使得开发者能够轻松地处理TCP、UDP和HTTP等多种协议。在本例中,...
Netty 是一个高性能、异步事件驱动的网络应用程序框架,用于快速开发可维护的高性能协议服务器和客户端。在本项目中,我们将探讨如何利用 ...同时,与 Tomcat 的对比分析,可以让你更好地理解服务器容器的工作原理。
【TCP调试助手(基于Netty)】是一款专为Windows平台设计的TCP协议调试软件,它利用了Netty这一高性能、异步事件驱动的网络应用框架。Netty是由Java编写的,广泛应用于各种分布式系统、服务器和客户端之间的通信,尤其...
综上所述,要使用Tomcat实现WebSocket,你需要理解WebSocket的基本概念,配置Tomcat以支持WebSocket,编写WebSocket服务器端点代码,并在客户端使用适当的API与服务器进行通信。同时,还需要关注性能和安全方面的...
- **dubbo-parent**和**netty-parent**:这些可能是项目源码的父级目录,包含了dubbo和netty相关的模块或子项目,可能包括配置文件、源代码、测试用例等资源,供开发者深入研究和定制化开发。 综上所述,本项目旨在...
Netty 是一个高性能、异步事件驱动的网络应用程序框架,用于快速开发可维护的高性能协议服务器和客户端。在 Netty 中,"Pipeline"(管道)是其核心设计之一,它提供了一种处理进/出站数据的有效方式。下面我们将深入...
《跟闪电侠学Netty:Netty即时聊天实战与底层原理》是一本深入浅出的Netty技术指南,旨在帮助读者掌握Netty框架,并利用它实现即时聊天应用,同时理解其底层工作原理。Netty是Java领域的一款高性能、异步事件驱动的...
http-benchmark-netty基于java netty的http客户端工具&http高性能测试工具,web性能测试首选。解决业界web测试工具压力不足、压力不均匀、统计输出不完备、扩展不灵活等所有缺陷。 测试工具参数配置灵活,可满足一般...
在这个“Netty Protobuf3 测试服务器”项目中,开发者使用Netty框架来构建一个服务器,该服务器与Unity游戏引擎中的protobuf3(Protocol Buffers版本3)进行通信。protobuf3是Google开发的一种数据序列化协议,它...
本文将深入探讨Netty与Thrift结合实现高并发高性能的关键技术点。 #### 二、Netty 高性能分析 ##### 2.1 RPC调用性能瓶颈分析 在传统的RPC框架中,主要存在以下三大性能瓶颈: 1. **网络传输方式**:传统的RPC...
将 Netty 与 Spring 集成,可以利用 Netty 的高性能网络通信能力,同时享受 Spring 提供的便捷的组件管理和应用结构。 在 Netty 和 Spring 集成的过程中,通常涉及以下几个关键知识点: 1. **Spring 上下文**: 在...
同过netty实现HTTP服务器(或者客户端) 。务器提供诸如HTML文件和其他内容之类的资源,或代表客户端执行其他功能,向客户端返回响应消息。 响应包含有关请求的完成状态信息,并且还可以在其消息正文中包含所请求的...
java netty接收串口数据 开启windows串口工具 发送串口数据调试助手
【标题】"Idea+springboot+netty打包执行测试" 涉及到的是一个集成开发环境(IntelliJ IDEA,简称Idea)、Spring Boot和Netty的项目打包与运行流程。这是一个常见的Java微服务开发场景,其中Spring Boot用于构建后端...