Netty NIO 框架性能压测-短链接-对比Tomcat
压测方案
- 准备多个文件大小分别为 1k 10k 100k 300k
- 使用ab分别按 [50,2000](按50逐渐叠加)压测服务,每次请求10W次
- 硬件信息:CPU:Intel(R) Xeon(R) CPU 1.86GHz ×4 4G
- 统计脚本:grep "Requests per second:" 300k_* | awk -F':' '{print substr($1,6),$3}'|sort -n
- 1k 10k 压测的时候load维持在3左右,100k 300k的load飙升到5 。
压测结果
- 在小文件(小于10k)情况下Netty的性能要优于Tomcat,qps大概能提升50%,而且比Tomcat稳定。
- 在并发量增大时候Netty表现得比Tomcat稳定,通过修改内核加快TIME_WAIT的回收时间,从而提高系统的并发量。
- 在大文件的情况下Netty没有任何优势,而且线程池相关的没有Tomcat优秀,Tomcat的内存回收更优秀些。
- 结论:Netty适合搭建轻量级的应用,特别适合传输内容少,但是并发量非常高的应用。或者是大文件下载服务器。
修改TIME_WAIT回收时间
vi /etc/sysctl.conf
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
/sbin/sysctl -p
net.ipv4.tcp_syncookies = 1 表示开启SYN Cookies。当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SYN攻击,默认为0,表示关闭; net.ipv4.tcp_tw_reuse = 1 表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭; net.ipv4.tcp_tw_recycle = 1 表示开启TCP连接中TIME-WAIT sockets的快速回收,默认为0,表示关闭。 net.ipv4.tcp_fin_timeout 修改系統默认的 TIMEOUT 时间
相关数据(下 载)
===== Netty =====
====== 1k ======
50 15661.50 [#/sec] (mean)
100 13429.52 [#/sec] (mean)
150 15385.05 [#/sec] (mean)
200 15598.34 [#/sec] (mean)
250 15135.97 [#/sec] (mean)
300 13494.79 [#/sec] (mean)
350 15102.49 [#/sec] (mean)
400 14614.11 [#/sec] (mean)
450 13463.52 [#/sec] (mean)
500 13447.48 [#/sec] (mean)
550 13126.29 [#/sec] (mean)
600 11108.25 [#/sec] (mean)
650 11073.34 [#/sec] (mean)
700 14518.88 [#/sec] (mean)
750 13409.66 [#/sec] (mean)
800 13060.86 [#/sec] (mean)
850 11938.25 [#/sec] (mean)
900 13133.88 [#/sec] (mean)
950 13670.75 [#/sec] (mean)
1000 13803.70 [#/sec] (mean)
1050 16414.20 [#/sec] (mean)
1100 14770.09 [#/sec] (mean)
1150 11108.65 [#/sec] (mean)
1200 13294.72 [#/sec] (mean)
1250 13448.52 [#/sec] (mean)
1300 15128.31 [#/sec] (mean)
1350 13367.31 [#/sec] (mean)
1400 14277.91 [#/sec] (mean)
1450 13193.80 [#/sec] (mean)
1500 14272.63 [#/sec] (mean)
1550 11004.96 [#/sec] (mean)
1600 13438.72 [#/sec] (mean)
1650 13105.43 [#/sec] (mean)
1700 13653.39 [#/sec] (mean)
1750 13366.72 [#/sec] (mean)
1800 12727.40 [#/sec] (mean)
1850 13075.32 [#/sec] (mean)
1900 11103.91 [#/sec] (mean)
1950 13463.83 [#/sec] (mean) ====== 10k ======
50 7280.51 [#/sec] (mean)
100 9089.69 [#/sec] (mean)
150 9423.90 [#/sec] (mean)
200 8130.07 [#/sec] (mean)
250 8142.88 [#/sec] (mean)
300 8311.20 [#/sec] (mean)
350 8512.20 [#/sec] (mean)
400 7940.84 [#/sec] (mean)
450 7823.32 [#/sec] (mean)
500 8284.60 [#/sec] (mean)
550 8785.93 [#/sec] (mean)
600 7725.20 [#/sec] (mean)
650 7753.23 [#/sec] (mean)
700 8184.61 [#/sec] (mean)
750 8027.75 [#/sec] (mean)
800 7934.49 [#/sec] (mean)
850 7792.94 [#/sec] (mean)
900 7734.34 [#/sec] (mean)
950 7118.27 [#/sec] (mean)
1000 7866.23 [#/sec] (mean)
1050 7724.82 [#/sec] (mean)
1100 7734.17 [#/sec] (mean)
1150 7688.83 [#/sec] (mean)
1200 7359.90 [#/sec] (mean)
1250 7526.02 [#/sec] (mean)
1300 7515.24 [#/sec] (mean)
1350 6639.51 [#/sec] (mean)
1400 7902.36 [#/sec] (mean)
1450 7447.63 [#/sec] (mean)
1500 8216.35 [#/sec] (mean)
1550 8133.42 [#/sec] (mean)
1600 7728.28 [#/sec] (mean)
1650 7724.26 [#/sec] (mean)
1700 7622.26 [#/sec] (mean)
1750 7848.25 [#/sec] (mean)
1800 7715.88 [#/sec] (mean)
1850 7594.04 [#/sec] (mean)
1900 8017.95 [#/sec] (mean)
1950 7992.33 [#/sec] (mean) ====== 100k ======
50 1079.56 [#/sec] (mean)
100 1078.64 [#/sec] (mean)
150 1080.74 [#/sec] (mean)
200 1074.42 [#/sec] (mean)
250 1082.69 [#/sec] (mean)
300 1084.87 [#/sec] (mean)
350 1080.00 [#/sec] (mean)
400 1046.49 [#/sec] (mean)
450 1050.25 [#/sec] (mean)
500 1052.89 [#/sec] (mean)
550 1046.49 [#/sec] (mean)
600 1059.16 [#/sec] (mean)
650 1051.33 [#/sec] (mean)
700 1050.23 [#/sec] (mean)
750 1045.41 [#/sec] (mean)
800 1054.51 [#/sec] (mean)
850 1034.61 [#/sec] (mean)
900 1045.55 [#/sec] (mean)
950 1036.36 [#/sec] (mean) ====== 3000k ======
50 345.95 [#/sec] (mean)
100 355.97 [#/sec] (mean)
150 361.02 [#/sec] (mean)
200 363.39 [#/sec] (mean)
250 358.99 [#/sec] (mean)
300 332.52 [#/sec] (mean)
350 320.66 [#/sec] (mean)
400 315.49 [#/sec] (mean)
450 305.72 [#/sec] (mean)
900 304.57 [#/sec] (mean) ===== Tomcat =====
====== 1k ======
50 8808.85 [#/sec] (mean)
100 9933.93 [#/sec] (mean)
150 11037.66 [#/sec] (mean)
200 10857.99 [#/sec] (mean)
250 10389.63 [#/sec] (mean)
300 11054.51 [#/sec] (mean)
350 10397.66 [#/sec] (mean)
400 10617.54 [#/sec] (mean)
450 9600.62 [#/sec] (mean)
500 10822.00 [#/sec] (mean)
550 10815.92 [#/sec] (mean)
600 11385.86 [#/sec] (mean)
650 11094.66 [#/sec] (mean)
700 10819.33 [#/sec] (mean)
750 10821.28 [#/sec] (mean)
800 9009.25 [#/sec] (mean)
850 10814.18 [#/sec] (mean)
900 9542.68 [#/sec] (mean)
950 11095.51 [#/sec] (mean)
1000 10811.53 [#/sec] (mean)
1050 11084.72 [#/sec] (mean)
1100 11089.07 [#/sec] (mean)
1150 9590.15 [#/sec] (mean)
1200 13826.40 [#/sec] (mean)
1250 8186.03 [#/sec] (mean)
1300 13961.24 [#/sec] (mean)
1350 11077.12 [#/sec] (mean)
1400 16536.29 [#/sec] (mean)
1450 11430.66 [#/sec] (mean)
1500 10817.56 [#/sec] (mean)
1550 16195.09 [#/sec] (mean)
1600 17205.66 [#/sec] (mean)
1650 13300.61 [#/sec] (mean)
1700 11061.43 [#/sec] (mean)
1750 10837.05 [#/sec] (mean)
1800 9786.94 [#/sec] (mean)
1850 10808.81 [#/sec] (mean)
1900 13019.67 [#/sec] (mean)
1950 10090.06 [#/sec] (mean) ====== 10k ======
50 5513.00 [#/sec] (mean)
100 7093.53 [#/sec] (mean)
150 9134.78 [#/sec] (mean)
200 8910.81 [#/sec] (mean)
250 9240.74 [#/sec] (mean)
300 7805.80 [#/sec] (mean)
350 8661.73 [#/sec] (mean)
400 8835.57 [#/sec] (mean)
450 7966.94 [#/sec] (mean)
500 8322.71 [#/sec] (mean)
550 6575.24 [#/sec] (mean)
600 8726.30 [#/sec] (mean)
650 8108.30 [#/sec] (mean)
700 9226.79 [#/sec] (mean)
750 8834.83 [#/sec] (mean)
800 8386.70 [#/sec] (mean)
850 8380.58 [#/sec] (mean)
900 8323.48 [#/sec] (mean)
950 9060.00 [#/sec] (mean)
1000 7213.51 [#/sec] (mean)
1050 9504.06 [#/sec] (mean)
1100 9381.86 [#/sec] (mean)
1150 8839.41 [#/sec] (mean)
1200 9760.02 [#/sec] (mean)
1250 9476.96 [#/sec] (mean)
1300 8366.04 [#/sec] (mean)
1350 9651.87 [#/sec] (mean)
1400 9186.07 [#/sec] (mean)
1450 9600.16 [#/sec] (mean)
1500 8289.33 [#/sec] (mean)
1550 9399.26 [#/sec] (mean)
1600 8205.92 [#/sec] (mean)
1650 8306.61 [#/sec] (mean)
1700 9464.74 [#/sec] (mean)
1750 8682.26 [#/sec] (mean)
1800 9589.63 [#/sec] (mean)
1850 8315.31 [#/sec] (mean)
1900 9174.38 [#/sec] (mean)
1950 8956.78 [#/sec] (mean) ====== 100k ======
50 1033.41 [#/sec] (mean)
100 1054.92 [#/sec] (mean)
150 1061.72 [#/sec] (mean)
200 1075.20 [#/sec] (mean)
300 373.05 [#/sec] (mean)
350 375.34 [#/sec] (mean)
400 376.29 [#/sec] (mean)
450 376.51 [#/sec] (mean)
500 377.04 [#/sec] (mean)
550 377.09 [#/sec] (mean)
650 363.08 [#/sec] (mean)
700 368.69 [#/sec] (mean) ====== 300k ======
50 354.93 [#/sec] (mean)
100 361.82 [#/sec] (mean)
150 366.71 [#/sec] (mean)
200 369.58 [#/sec] (mean)
250 372.58 [#/sec] (mean)
300 374.43 [#/sec] (mean)
350 375.92 [#/sec] (mean)
400 376.23 [#/sec] (mean)
450 376.93 [#/sec] (mean)
500 376.61 [#/sec] (mean)
550 377.67 [#/sec] (mean)
600 372.58 [#/sec] (mean)
Netty NIO 框架性能压测-短链接-对比Tomcat的更多相关文章
- thinkphp5 yii2 laravel5.1 框架性能压测对比图
nginx+php7环境,opcache已经开启,每测试一个框架都重启服务器并且预热访问三次,压测工具ab.exe. laravel,thinkphp,yii都已关闭debug,该做的优化命令都搞了, ...
- 并发模式与 RPS 模式之争,性能压测领域的星球大战
本文是<如何做好性能压测>系列专题分享的第四期,该专题将从性能压测的设计.实现.执行.监控.问题定位和分析.应用场景等多个纬度对性能压测的全过程进行拆解,以帮助大家构建完整的性能压测的理论 ...
- 性能压测中的SLA,你知道吗?
本文是<Performance Test Together>(简称PTT)系列专题分享的第6期,该专题将从性能压测的设计.实现.执行.监控.问题定位和分析.应用场景等多个纬度对性能压测的全 ...
- 性能压测诡异的Requests/second 响应刺尖问题
最近一段时间都在忙着转java项目最后的冲刺,前期的coding翻代码.debug.fixbug都逐渐收尾,进入上线前的性能压测. 虽然不是大促前的性能压测要求,但是为了安全起见,需要摸个底心里有个数 ...
- jmeter系列-如何实现像loadrunner一样,多个并发用户先通过登录初始化,然后做并发的接口性能压测
自动转开发后,就很少关注性能测试方面的东西,最近在帮朋友做一个性能压测,由于朋友那边的公司比较小,环境比较简单,而且是对http服务进行的压测,所以最终 选用了jmeter来实现这个压测. 如下就是我 ...
- 性能压测,SQL查询异常
早上测试对性能压测,发现取sequence服务大量超时报错,查询线上的监控SQL: 大量这个查询,我在DeviceID和Isdelete上建有复合索引,应该很快,而且我测试了一下,取值,执行效率很高, ...
- jmeter性能压测瓶颈排查-网络带宽
问题: 有一台机器做性能压测的时候,无论开多少个线程,QPS一直压不上去,而服务器和数据库的性能指标(主要是CPU和内存)一直维持在很低的水平. 希望帮忙排查一下原因. 过去看了下进行压测的接口代码, ...
- [SCF+wetest+jmeter]简单云性能压测工具使用方案
前言 压测太难?局域网压力无法判断服务器网络指标?无法产生非常大的并发量?云性能太贵? 也许我们可以把各种简单的工具拼起来进行压力测试! 准备 https://cloud.tencent.com/pr ...
- 软件性能测试分析与调优实践之路-JMeter对RPC服务的性能压测分析与调优-手稿节选
一.JMeter 如何通过自定义Sample来压测RPC服务 RPC(Remote Procedure Call)俗称远程过程调用,是常用的一种高效的服务调用方式,也是性能压测时经常遇到的一种服务调用 ...
随机推荐
- 将Linux下的Android签名对pk8和pem转换为Eclipse下的签名(keystore)
一 在github上下载工具 https://github.com/getfatday/keytool-importkeypair 二 将工具在Linux环境下解压或者解压后Copy到Linux下,运 ...
- 【leetcode】Majority Element
题目概述: Given an array of size n, find the majority element. The majority element is the element that ...
- 为什么kafka使用磁盘而不是内存
Kafka最核心的思想是使用磁盘,而不是使用内存,可能所有人都会认为,内存的速度一定比磁盘快,我也不例外.在看了Kafka的设计思想,查阅了相应资料再加上自己的测试后,发现磁盘的顺序读写速度和内存持平 ...
- 简单Excel表格上传下载,POI
一.废话 Excel表格是office软件中的一员,几乎是使用次数最多的办公软件.所以在java进行企业级应用开发的时候经常会用到对应的上传下载便利办公. 目前,比较常用的实现Java导入.导出Exc ...
- python lambda
匿名函数和lambda: lambda [args1,[args2]] : expression python 使用lambda来创建匿名函数,匿名函数不需要以标准的方式进行创建,但是作为函数,它们也 ...
- input的实时监控
<input id="phone" type="tel" placeholder="请输入手机号"> $("#phon ...
- dedecms 按权重排序不准或BUG的处理方法
dede:list 的方法 1.找到"根目录\include\arc.listview.class.php"文件. 2.修改代码:在文件第727行处添加按weight排序判断代码( ...
- Android -- ImageView(控制图片的大小以及旋转的角度)
1.
- GridView点击行触发SelectedIndexChanged事件
1.在<% @Page ...... %>指令中添加 EnableEventValidation="false" 2.在RowDataBound事件中添加 protec ...
- SqlServer操作大全
一.基础1.说明:创建数据库CREATE DATABASE database-name2.说明:删除数据库drop database dbname3.说明:备份sql server--- 创建 备份数 ...