当前位置:网站首页>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状态。
就是在对方连接关闭之后,程序里没有检测到,或者程序压根就忘记了这个时候需要关闭连接,于是这个资源就一直被程序占着。
个人觉得这种情况,通过服务器内核参数也没办法解决,服务器对于程序抢占的资源没有主动回收的权利,除非终止程序运行。查代码解决
边栏推荐
猜你喜欢

C language improvement (I)

“12306”的架构到底有多牛逼?

第3章业务功能开发(线索备注的删除和修改)

快速掌握Nodejs安装以及入门

矿山开采虚拟现实vr安全培训提升员工警惕性和防护意识

Summarize in the middle of the year | talk to yourself, live in the present, and count every step

Practice and experience of security compliance in instant messaging scenarios

多线程浅谈

When I look at the source code, what am I thinking?

After 4 years of testing experience, I finally entered Alibaba. Two months later, I chose to resign naked
随机推荐
What happens if you have to use ArrayList in multithreading?
Object based real-time spatial audio rendering - Dev for dev column
响应式织梦模板装修设计类网站
Chapter 3 business function development (deletion and modification of clue remarks)
防止重复点击
2022/07/28 学习笔记 (day18) 常用API
当我看源码的时候,我在想什么?
Altium designer outputs Gerber and other production documents
How much is the report development cost in the application system?
关于高并发,我想聊一聊。
DevOps 团队如何抵御 API 攻击?
Navigation -- realize data transmission and data sharing between fragments
Character flow comprehensive exercise problem solving process
应用系统中的报表开发成本值多少?
Day 14: continued day 13 label related knowledge
What should I do if excel opens a CSV file containing Chinese characters and there is garbled code?
【上传图片可剪裁-1】
ES6 语法扩展
Rust 列表(Vec)复制
Esbuild Bundler HMR