`
javatar
  • 浏览: 1704499 次
  • 性别: Icon_minigender_1
  • 来自: 杭州699号
社区版块
存档分类
最新评论

Grizzly和Netty以及Mina简单性能对比

 
阅读更多
转于自己在公司的Blog:
http://pt.alibaba-inc.com/wp/experience_1336/grizzly-netty-mina-performance.html

最近在服务框架中尝试增加了Grizzly传输集成,简单测试后发现,TPS(每秒处理请求数)略低于Netty,略高于Mina,相差并不是很大,但TPS比Netty稳定很多(每秒方差小),不会出现大幅波动,可以考虑备选。

Mina为ApacheDirectory服务器的底层NIO框架:http://mina.apache.org
Netty为JBoss的NIO框架:http://www.jboss.org/netty
Grizzly是Sun的GlassFish服务器的底层NIO框架:http://grizzly.java.net

注:以下数据为开发环境简单测试,存在较大统计误差,并且Mina采用的是旧版本(因新版本API不兼容),可能存在测试的不公平性。

测试版本:
Grizzly2.1.1,Netty3.2.2,Mina1.1.7

测试结论:
服务器Linux下TPS,Netty最高,但波动非常大,Grizzly次之,但波动小,Mina最低。
本机Windows下TPS,Grizzly最高,Mina次之,Netty最低。

测试结果:
单一长连接,100并发,来回数据均为1K:
服务器Linux下TPS,Grizzly:15061,Netty:15211,Mina: 14828。
本机Windows下TPS,Grizzly:6945,Netty:4433,Mina:5750。

测试详细:

1. Linux:

(1) Grizzly:
[01:48:17] count: 72059, error: 0,tps:16046
[01:48:19] count: 103081, error: 0,tps:15412
[01:48:21] count: 133459, error: 0,tps:15169
[01:48:23] count: 164335, error: 0,tps:15436
[01:48:25] count: 195370, error: 0,tps:15516
[01:48:27] count: 226222, error: 0,tps:15425
[01:48:29] count: 256864, error: 0,tps:15320
[01:48:31] count: 287435, error: 0,tps:15284
[01:48:33] count: 317908, error: 0,tps:15235
[01:48:35] count: 348632, error: 0,tps:15361
[01:48:37] count: 379702, error: 0,tps:15534
[01:48:39] count: 410473, error: 0,tps:15384
[01:48:41] count: 441696, error: 0,tps:15610
[01:48:43] count: 472648, error: 0,tps:15474
[01:48:45] count: 503532, error: 0,tps:15440
[01:48:47] count: 534368, error: 0,tps:15417
[01:48:49] count: 565526, error: 0,tps:15578
[01:48:51] count: 596600, error: 0,tps:15536
[01:48:53] count: 627111, error: 0,tps:15254
[01:48:55] count: 657956, error: 0,tps:15422
[01:48:57] count: 689197, error: 0,tps:15619
[01:48:59] count: 719944, error: 0,tps:15372
[01:49:01] count: 750797, error: 0,tps:15426
[01:49:03] count: 781439, error: 0,tps:15321
[01:49:05] count: 812245, error: 0,tps:15401
[01:49:07] count: 842992, error: 0,tps:15372
[01:49:09] count: 873677, error: 0,tps:15341
[01:49:11] count: 904656, error: 0,tps:15488
[01:49:13] count: 935273, error: 0,tps:15307
[01:49:15] count: 965723, error: 0,tps:15224
[01:49:17] count: 996358, error: 0,tps:15316
+================================================================+
|             Dubbo Remoting Performance Test Report             |
+================================================================+
|                        Test Environment                        |
+----------------------------------------------------------------+
+----------------------------------------------------------------+
| Client OS: Linux 2.6.18-128.el5xen amd64                       |
| Client CPU: 16 cores                                           |
| Client JVM: Java HotSpot(TM) 64-Bit Server VM 1.6.0_18-b07     |
| Client Memory: 535,953,408 bytes (Max: 535,953,408 bytes)      |
| Client Network: eth0                                           |
| Client MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
|                           Test Scene                           |
+----------------------------------------------------------------+
| Client Transporter: grizzly                                    |
| Serialization: hessian2                                        |
| Response Timeout: 5000 ms                                      |
| Data Length: 1024 bytes                                        |
| Client Shared Connections: 1                                   |
| Client Concurrent Threads: 100                                 |
| Run Times Per Thread: 10000                                    |
+----------------------------------------------------------------+
|                          Test Result                           |
+----------------------------------------------------------------+
| Succeeded Requests: 1,000,000                                  |
| Failed Requests: 0                                             |
| Client Elapsed Time: 3404 ms                                   |
| Average Response Time: 6 ms                                    |
| Requests Per Second: 15061/s                                   |
| Throughput Per Second: 30,846,411 bytes/s                      |
+================================================================+


(2) Netty:
[01:53:56] count: 113330, error: 0,tps:17381
[01:53:58] count: 136859, error: 0,tps:11764
[01:54:00] count: 160062, error: 0,tps:11601
[01:54:02] count: 186185, error: 0,tps:13060
[01:54:04] count: 209548, error: 0,tps:11681
[01:54:06] count: 236865, error: 0,tps:13658
[01:54:08] count: 263920, error: 0,tps:13526
[01:54:10] count: 288269, error: 0,tps:12174
[01:54:12] count: 312995, error: 0,tps:12362
[01:54:14] count: 336914, error: 0,tps:11958
[01:54:16] count: 362085, error: 0,tps:12584
[01:54:18] count: 385552, error: 0,tps:11732
[01:54:20] count: 409792, error: 0,tps:12119
[01:54:22] count: 442461, error: 0,tps:16334
[01:54:24] count: 469138, error: 0,tps:13338
[01:54:26] count: 493428, error: 0,tps:12144
[01:54:28] count: 521258, error: 0,tps:13915
[01:54:30] count: 560968, error: 0,tps:19854
[01:54:32] count: 609262, error: 0,tps:24146
[01:54:34] count: 657769, error: 0,tps:24250
[01:54:36] count: 704225, error: 0,tps:23226
[01:54:38] count: 736721, error: 0,tps:16248
[01:54:40] count: 771944, error: 0,tps:17611
[01:54:42] count: 808276, error: 0,tps:18164
[01:54:44] count: 840891, error: 0,tps:16307
[01:54:46] count: 873613, error: 0,tps:16360
[01:54:48] count: 911968, error: 0,tps:19174
[01:54:50] count: 960476, error: 0,tps:24248
+================================================================+
|             Dubbo Remoting Performance Test Report             |
+================================================================+
|                        Test Environment                        |
+----------------------------------------------------------------+
+----------------------------------------------------------------+
| Client OS: Linux 2.6.18-128.el5xen amd64                       |
| Client CPU: 16 cores                                           |
| Client JVM: Java HotSpot(TM) 64-Bit Server VM 1.6.0_18-b07     |
| Client Memory: 536,215,552 bytes (Max: 536,215,552 bytes)      |
| Client Network: eth0                                           |
| Client MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
|                           Test Scene                           |
+----------------------------------------------------------------+
| Client Transporter: netty                                      |
| Serialization: hessian2                                        |
| Response Timeout: 5000 ms                                      |
| Data Length: 1024 bytes                                        |
| Client Shared Connections: 1                                   |
| Client Concurrent Threads: 100                                 |
| Run Times Per Thread: 10000                                    |
+----------------------------------------------------------------+
|                          Test Result                           |
+----------------------------------------------------------------+
| Succeeded Requests: 1,000,000                                  |
| Failed Requests: 0                                             |
| Client Elapsed Time: 3151 ms                                   |
| Average Response Time: 6 ms                                    |
| Requests Per Second: 15211/s                                   |
| Throughput Per Second: 31,152,738 bytes/s                      |
+================================================================+


(3) Mina:
[01:56:39] count: 103543, error: 0,tps:14427
[01:56:41] count: 132855, error: 0,tps:14655
[01:56:43] count: 166918, error: 0,tps:17021
[01:56:45] count: 195301, error: 0,tps:14190
[01:56:47] count: 224616, error: 0,tps:14657
[01:56:49] count: 262498, error: 0,tps:18941
[01:56:51] count: 294846, error: 0,tps:16174
[01:56:53] count: 334369, error: 0,tps:19761
[01:56:55] count: 353994, error: 0,tps:9812
[01:56:57] count: 379195, error: 0,tps:12596
[01:56:59] count: 423003, error: 0,tps:21886
[01:57:01] count: 466447, error: 0,tps:21721
[01:57:03] count: 496609, error: 0,tps:15081
[01:57:05] count: 514800, error: 0,tps:9095
[01:57:07] count: 539324, error: 0,tps:12262
[01:57:09] count: 571361, error: 0,tps:16018
[01:57:11] count: 594834, error: 0,tps:11736
[01:57:13] count: 616056, error: 0,tps:10611
[01:57:15] count: 643891, error: 0,tps:13917
[01:57:17] count: 662115, error: 0,tps:9111
[01:57:19] count: 688659, error: 0,tps:13271
[01:57:21] count: 724968, error: 0,tps:18154
[01:57:23] count: 767680, error: 0,tps:21356
[01:57:25] count: 802471, error: 0,tps:17395
[01:57:27] count: 842291, error: 0,tps:19910
[01:57:29] count: 877187, error: 0,tps:17448
[01:57:31] count: 917275, error: 0,tps:20044
[01:57:33] count: 945382, error: 0,tps:14053
[01:57:35] count: 972663, error: 0,tps:13637
+================================================================+
|             Dubbo Remoting Performance Test Report             |
+================================================================+
|                        Test Environment                        |
+----------------------------------------------------------------+
+----------------------------------------------------------------+
| Client OS: Linux 2.6.18-128.el5xen amd64                       |
| Client CPU: 16 cores                                           |
| Client JVM: Java HotSpot(TM) 64-Bit Server VM 1.6.0_18-b07     |
| Client Memory: 536,150,016 bytes (Max: 536,150,016 bytes)      |
| Client Network: eth0                                           |
| Client MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
|                           Test Scene                           |
+----------------------------------------------------------------+
| Client Transporter: mina                                       |
| Serialization: hessian2                                        |
| Response Timeout: 5000 ms                                      |
| Data Length: 1024 bytes                                        |
| Client Shared Connections: 1                                   |
| Client Concurrent Threads: 100                                 |
| Run Times Per Thread: 10000                                    |
+----------------------------------------------------------------+
|                          Test Result                           |
+----------------------------------------------------------------+
| Succeeded Requests: 1,000,000                                  |
| Failed Requests: 0                                             |
| Client Elapsed Time: 3207 ms                                   |
| Average Response Time: 6 ms                                    |
| Requests Per Second: 14828/s                                   |
| Throughput Per Second: 30,368,031 bytes/s                      |
+================================================================+


2. Windows:

(1) Grizzly:
+================================================================+
|             Dubbo Remoting Performance Test Report             |
+================================================================+
|                        Test Environment                        |
+----------------------------------------------------------------+
| Server OS: Windows XP 5.1 x86                                  |
| Server CPU: 2 cores                                            |
| Server JVM: Java HotSpot(TM) Client VM 1.6.0_18-b07            |
| Server Memory: 16,252,928 bytes (Max: 259,522,560 bytes)       |
| Server Network: Intel(R) WiFi Link 5100 AGN - Teefer2 Miniport |
| Server MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
| Client OS: Windows XP 5.1 x86                                  |
| Client CPU: 2 cores                                            |
| Client JVM: Java HotSpot(TM) Client VM 1.6.0_18-b07            |
| Client Memory: 16,515,072 bytes (Max: 259,522,560 bytes)       |
| Client Network: Intel(R) WiFi Link 5100 AGN - Teefer2 Miniport |
| Client MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
|                           Test Scene                           |
+----------------------------------------------------------------+
| Server Transporter: grizzly                                    |
| Server Service Threads: 100                                    |
| Client Transporter: grizzly                                    |
| Serialization: hessian2                                        |
| Response Timeout: 5000 ms                                      |
| Data Length: 1024 bytes                                        |
| Client Shared Connections: 1                                   |
| Client Concurrent Threads: 100                                 |
| Run Times Per Thread: 10000                                    |
+----------------------------------------------------------------+
|                          Test Result                           |
+----------------------------------------------------------------+
| Succeeded Requests: 1,000,000                                  |
| Failed Requests: 0                                             |
| Client Elapsed Time: 14393 ms                                  |
| Average Response Time: 14 ms                                   |
| Requests Per Second: 6945/s                                    |
| Throughput Per Second: 14,224,879 bytes/s                      |
+================================================================+


(2) Netty:
+================================================================+
|             Dubbo Remoting Performance Test Report             |
+================================================================+
|                        Test Environment                        |
+----------------------------------------------------------------+
| Server OS: Windows XP 5.1 x86                                  |
| Server CPU: 2 cores                                            |
| Server JVM: Java HotSpot(TM) Client VM 1.6.0_18-b07            |
| Server Memory: 16,252,928 bytes (Max: 259,522,560 bytes)       |
| Server Network: Intel(R) WiFi Link 5100 AGN - Teefer2 Miniport |
| Server MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
| Client OS: Windows XP 5.1 x86                                  |
| Client CPU: 2 cores                                            |
| Client JVM: Java HotSpot(TM) Client VM 1.6.0_18-b07            |
| Client Memory: 16,646,144 bytes (Max: 259,522,560 bytes)       |
| Client Network: Intel(R) WiFi Link 5100 AGN - Teefer2 Miniport |
| Client MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
|                           Test Scene                           |
+----------------------------------------------------------------+
| Server Transporter: netty                                      |
| Server Service Threads: 100                                    |
| Client Transporter: netty                                      |
| Serialization: hessian2                                        |
| Response Timeout: 5000 ms                                      |
| Data Length: 1024 bytes                                        |
| Client Shared Connections: 1                                   |
| Client Concurrent Threads: 100                                 |
| Run Times Per Thread: 10000                                    |
+----------------------------------------------------------------+
|                          Test Result                           |
+----------------------------------------------------------------+
| Succeeded Requests: 999,988                                    |
| Failed Requests: 12                                            |
| Client Elapsed Time: 34434 ms                                  |
| Average Response Time: 22 ms                                   |
| Requests Per Second: 4422/s                                    |
| Throughput Per Second: 9,057,411 bytes/s                       |
+================================================================+


(3) Mina:
+================================================================+
|             Dubbo Remoting Performance Test Report             |
+================================================================+
|                        Test Environment                        |
+----------------------------------------------------------------+
| Server OS: Windows XP 5.1 x86                                  |
| Server CPU: 2 cores                                            |
| Server JVM: Java HotSpot(TM) Client VM 1.6.0_18-b07            |
| Server Memory: 16,252,928 bytes (Max: 259,522,560 bytes)       |
| Server Network: Intel(R) WiFi Link 5100 AGN - Teefer2 Miniport |
| Server MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
| Client OS: Windows XP 5.1 x86                                  |
| Client CPU: 2 cores                                            |
| Client JVM: Java HotSpot(TM) Client VM 1.6.0_18-b07            |
| Client Memory: 16,646,144 bytes (Max: 259,522,560 bytes)       |
| Client Network: Intel(R) WiFi Link 5100 AGN - Teefer2 Miniport |
| Client MTU: 1500 bytes                                         |
+----------------------------------------------------------------+
|                           Test Scene                           |
+----------------------------------------------------------------+
| Server Transporter: mina                                       |
| Server Service Threads: 100                                    |
| Client Transporter: mina                                       |
| Serialization: hessian2                                        |
| Response Timeout: 5000 ms                                      |
| Data Length: 1024 bytes                                        |
| Client Shared Connections: 1                                   |
| Client Concurrent Threads: 100                                 |
| Run Times Per Thread: 10000                                    |
+----------------------------------------------------------------+
|                          Test Result                           |
+----------------------------------------------------------------+
| Succeeded Requests: 1,000,000                                  |
| Failed Requests: 0                                             |
| Client Elapsed Time: 6473 ms                                   |
| Average Response Time: 17 ms                                   |
| Requests Per Second: 5750/s                                    |
| Throughput Per Second: 11,777,750 bytes/s                      |
+================================================================+

分享到:
评论
5 楼 beykery 2013-07-18  
lz要不要换换版本测试,netty4性能有不小提升。
4 楼 duyibin1986 2012-12-27  
chembo 写道
finikes 写道
博主您好!
看了您的文章,深表谢意。
有个请求-能不能告知测试方法?或者工具
谢谢!


同求啊!

Dubbo Remoting Performance Test Report
3 楼 chembo 2012-09-07  
finikes 写道
博主您好!
看了您的文章,深表谢意。
有个请求-能不能告知测试方法?或者工具
谢谢!


同求啊!
2 楼 sodarfish 2011-11-23  
finikes 写道
博主您好!
看了您的文章,深表谢意。
有个请求-能不能告知测试方法?或者工具
谢谢!


同求。。。。
1 楼 finikes 2011-08-10  
博主您好!
看了您的文章,深表谢意。
有个请求-能不能告知测试方法?或者工具
谢谢!

相关推荐

    Netty面试题 +Netty综合面试题整合

    - 与 Java NIO、MINA、Grizzly 等比较,Netty 在易用性、性能、稳定性上具有优势。 在面试过程中,你可能需要展示对这些概念的理解,以及在实际项目中的应用经验。同时,了解如何解决常见的问题,如内存泄漏、性能...

    Netty5.0架构剖析和源码解读

    ### Netty5.0架构剖析和源码解读 #### 1. 概述 ##### 1.1. JAVA的IO演进 ###### 1.1.1. 传统BIO通信的弊端 在JDK 1.4之前,Java网络编程主要依赖于传统的同步阻塞I/O模型(BIO)。这一模型虽然简化了应用程序的...

    Netty原理和使用

    其竞争对手是:ApacheMINA和Grizzly。传统堵塞的IO读取如下:而使用NIO如下:传统硬件的堵塞如下,从内存中读取数据,然后写到磁盘,而CPU一直等到磁盘写完成,磁盘的写操作是慢的,这段时间CPU

    Java面试题10道Java高级必备的Netty面试题!.pdf

    - Netty与其他网络库(如Grizzly或Mina)相比有哪些优势? 通过以上面试题,可以全面评估候选人在Netty框架的理解深度和实践经验。深入学习和掌握这些知识点,不仅有助于在面试中脱颖而出,还能在实际开发中提高...

    Mina 实例 包含jar包

    在描述中提到的"包含了所需要的jar包",这意味着这个压缩包可能包含了Mina框架本身、相关的依赖库,例如Apache Commons Logging用于日志记录,可能还有其他辅助库,如Netty或Grizzly等,这些都可能在实现Mina示例时...

    高效、灵活、易用的go语言游戏服务器框架,网络实现类似grizzly.zip

    仙女图书馆(正在制作中)目标灵活、灵活、易扩展的异步网络框架,设计高效参考netty、mina、grizzly,使用责任链设计模式支持tcp,websocket,kcp协议支持protobuf,json,xml,gob编码支持默认的消息处理线程模型支持...

    java开源包3

    6、支持多种通信框架(Mina/Netty/Grizzly),支持多种序列化/反序列化(Java/Hessian/PB); 7、支持自定义通信协议,可完全替换NFS-RPC自带的协议。 淘宝开放平台JAVA版SDK top4java 设计原则 容易维护扩展(不...

    JAVA网络通信系统的研究与开发(论文+源代码+开题报告)

    Java世界中有多个成熟的网络通信框架,如Netty、Grizzly、MINA等。这些框架封装了底层的I/O操作,提供了高度可扩展和性能优良的网络服务。例如,Netty因其高性能、易用性和灵活性,在实时通信、游戏服务器等领域广泛...

    java 网络框架

    网络框架如Netty、Grizzly和MINA简化了网络应用的开发。这些框架提供了高级API,用于处理多线程、异步I/O、事件驱动的网络编程。例如,Netty以其高性能、灵活性和易用性而闻名,它使用了NIO(非阻塞I/O)来处理大量...

    dubbo源码分析系列1

    提供了Netty、Mina、Grizzly、HTTP、P2P和Zookeeper等多种实现,实现远程方法调用。 - **dubbo-monitor-api**:监控模块,用于收集服务调用的各类信息,如调用耗时、调用量和结果等。默认实现简单,生产环境中通常...

    word源码java-fairy:高效,灵活,易用的go语言游戏服务器框架,网络实现类似grizzly

    目标:高效,灵活,易用,易扩展的异步网络框架,设计上参考netty,mina,grizzly,使用责任链设计模式 支持tcp,websocket,kcp协议 支持protobuf,json,xml,gob编码 支持默认的消息处理线程模型 支持高效定时器 一:用例 ...

    dubbo源码分析系列

    它还提供了多种协议和技术框架的实现方式,如Netty、Mina、Grizzly、HTTP等。 监控模块是服务治理的重要组成部分。Dubbo通过监控模块收集服务调用过程中的各种信息,如调用耗时、调用量、调用结果等,并可以将这些...

    rpc-server.zip

    **网络通信库的选择**:在Java中,如Netty、Mina、Grizzly等NIO框架广泛应用于高性能的网络应用开发,它们能够处理大量并发连接,并且提供灵活的事件驱动模型。`rpc-server.zip`可能使用了其中的一种或自定义的解决...

    第六课:Dubbo协议模块源码解析1

    - **dubbo协议**:默认使用Netty作为网络传输层,支持mina和grizzly,Hessian2作为默认序列化方式,适用于常规RPC调用,数据量小且提供者少于消费者的情况。 - **rmi协议**:基于Java RMI,使用Java原生二进制序列化...

    04.1、微服务--dubbo(41题)1

    11. 通信框架:默认使用Netty,也可选择Mina或Grizzly。 综上所述,Dubbo是一款强大的分布式服务框架,它提供了丰富的功能和高度的灵活性,使得开发者能够轻松地构建和管理微服务架构。然而,选择使用Dubbo还是...

    大厂面试必备Java核心题

    - 它支持多种通信框架,如默认的Netty框架,以及Grizzly、MINA等。 - Dubbo使用ZooKeeper作为服务注册中心,但也可选择使用Redis、Multicast等。 - Dubbo提供默认的Hessian序列化方式,同时也支持Java自带的序列...

    Dubbo30道高频面试题详解.docx

    此外,还可以选择mina、grizzly等其他框架。序列化方面,默认使用 Hessian2,支持其他序列化方式如Fastjson、Java自带的序列化、protobuf等,用于将对象转换为字节流进行网络传输。 【服务调用模式】 服务调用分为...

    dubbo开发jar包

    2. **dubbo-remoting**: 这部分处理网络通信,实现了基于TCP和HTTP的远程调用协议,如Netty、Grizzly、MINA等,使得服务间的通信成为可能。 3. **dubbo-rpc**: 提供了多种RPC实现,如Dubbo自身的Invoker、Exporter...

Global site tag (gtag.js) - Google Analytics