当前位置:网站首页>time_wait和close_wait产生原因
time_wait和close_wait产生原因
2022-07-29 01:58:00 【Meme_xp】
1.time_wait如何产生
首先调用close()发起主动关闭的一方,在发送最后一个ACK之后会进入time_wait的状态,也就说该发送方会保持2MSL时间之后才会回到初始状态。MSL值得是数据包在网络中的最大生存时间。产生这种结果使得这个TCP连接在2MSL连接等待期间。
2.time_wait状态产生的原因
1)为实现TCP全双工连接的可靠释放
2)为使旧的数据包在网络因过期而消失
3.time_wait状态如何避免
服务器可以设置SO_REUSEADDR套接字选项来通知内核,如果端口忙,但TCP连接位于TIME_WAIT状态时可以重用端口。
服务器保持了大量TIME_WAIT状态
原因
一些爬虫服务器或者WEB服务器。
带来问题
维护这些状态给Server带来负担。
解决思路很简单,就是让服务器能够快速回收和重用那些TIME_WAIT的资源。优化参数解决
服务器保持了大量CLOSE_WAIT状态
在被动关闭连接情况下,在已经接收到FIN,但是还没有发送自己的FIN的时刻,连接处于CLOSE_WAIT状态。
就是在对方连接关闭之后,程序里没有检测到,或者程序压根就忘记了这个时候需要关闭连接,于是这个资源就一直被程序占着。
个人觉得这种情况,通过服务器内核参数也没办法解决,服务器对于程序抢占的资源没有主动回收的权利,除非终止程序运行。查代码解决
边栏推荐
- 开启TLS加密的Proftpd安全FTP服务器安装指南
- ES6 syntax extension
- Problems encountered in special flow & properties property set instances and Solutions
- 【golang学习笔记2.2】 Map、结构体和接口
- Internet of things development -- mqtt message server emqx
- MySQL基本操作和基于MySQL基本操作的综合实例项目
- Thermistor temperature calculation formula program
- 即时通讯场景下安全合规的实践和经验
- Chapter 3 business function development (deletion and modification of clue remarks)
- [golang learning notes 2.2] map, structure and interface
猜你喜欢
Servlet三种实现方式
Talk about 11 tips for interface performance optimization
矿山开采虚拟现实vr安全培训提升员工警惕性和防护意识
Transform okhttp cache with retrofit
Jetpack -- navigation realizes page Jump
Keil5 open the engineering prompt not found device solution
防止勒索软件攻击数据的十种方法
Custom MVC principle and framework implementation
高效使用浏览器的5个小技巧,第1个技巧最实用
4年测试经验,好不容易进了阿里,两个月后我选择了裸辞...
随机推荐
发布融资需求1.29亿元,大科城项目路演持续浇灌科创“好苗子”
How to guarantee password security? How does the secure browser manage passwords?
[upload pictures can be cut-1]
FPGA刷题——存储器(RAM和FIFO的Verilog实现)
[RT learning note 1] RT thread peripheral routine - control LED light flashing
手把手教你安装VSCode(附带图解步骤)
多边形点测试
Navigation -- realize data transmission and data sharing between fragments
How awesome is the architecture of "12306"?
高效使用浏览器的5个小技巧,第1个技巧最实用
Excel 打开包含汉字的 csv 文件出现乱码该怎么办?
When synchronized encounters this thing, there is a big hole, so be careful
[upload picture 2-cropable]
如何利用 RPA 实现自动化获客?
What happens if you have to use ArrayList in multithreading?
如何在多御安全浏览器中自定义新标签页?
ES6 syntax extension
QT learning notes -37.qregex and regular expressions
Eight practical new functions of es2022
“两个披萨”团队的分支管理实践