Mina、netty、grizzly性能测试

转至 http://javatar.iteye.com/blog/1126171

最近在服务框架中尝试增加了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:
Java代码  收藏代码

    [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:
Java代码  收藏代码

    [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:
Java代码  收藏代码

    [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:
Java代码  收藏代码

    +================================================================+ 
    |             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:
Java代码  收藏代码

    +================================================================+ 
    |             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:
Java代码  收藏代码

    +================================================================+ 
    |             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                      | 
    +================================================================+ 

猜你喜欢

转载自proc-871113.iteye.com/blog/2198117
今日推荐