netty优化策略

1.设置 参数

keepAlive
tcpNoDelay
reuseAddress

2.设置linux os 参数:

pam limits by default is not loaded in ubuntu. So run the following command in a terminal

sudo gedit /etc/pam.d/su

uncomment the following line

#session required pam_limits.so

to

session required pam_limits.so

save and close the editor.

Now run the following command in terminal

sudo gedit /etc/security/limits.conf

and add the following lines to the end of the file (before the line # End of file)

* soft nofile 4084

* hard nofile 4084

Now reboot the machine and run ulimit -a and see the open files limits are now updated. enjoy!!

added two new lines

* soft nofile 20000

* hard nofile 20000

in file /etc/security/limits.conf

对性能影响比较大的几个配置项:

1) SO_RCVBUF和SO_SNDBUF:通常建议值为128K或者256K;

2) SO_TCPNODELAY:NAGLE算法通过将缓冲区内的小封包自动相连,组成较大的封包,阻止大量小封包的发送阻塞网络,从而提高网络应用效率。但是对于时延敏感的应用场景需要关闭该优化算法;

3) 软中断:如果Linux内核版本支持RPS(2.6.35以上版本),开启RPS后可以实现软中断,提升网络吞吐量。RPS根据数据包的源地址,目的地址以及目的和源端口,计算出一个hash值,然后根据这个hash值来选择软中断运行的cpu,从上层来看,也就是说将每个连接和cpu绑定,并通过这个hash值,来均衡软中断在多个cpu上,提升网络并行处理性能。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值