其他分享
首页 > 其他分享> > netty优化策略

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上,提升网络并行处理性能。

标签:netty,run,策略,limits,nofile,etc,following,优化,pam
来源: https://blog.csdn.net/crazy123456789/article/details/118332636