当前位置:网站首页>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状态。
就是在对方连接关闭之后,程序里没有检测到,或者程序压根就忘记了这个时候需要关闭连接,于是这个资源就一直被程序占着。
个人觉得这种情况,通过服务器内核参数也没办法解决,服务器对于程序抢占的资源没有主动回收的权利,除非终止程序运行。查代码解决
边栏推荐
- After 4 years of testing experience, I finally entered Alibaba. Two months later, I chose to resign naked
- QT qstackedwidget multi interface switching
- 4年测试经验,好不容易进了阿里,两个月后我选择了裸辞...
- How to guarantee password security? How does the secure browser manage passwords?
- Object based real-time spatial audio rendering - Dev for dev column
- 会议OA之会议通知
- 6年测试经验,教大家测试~如何把控项目
- 【上传图片2-可裁剪】
- 手把手教你安装VSCode(附带图解步骤)
- I want to talk about high concurrency.
猜你喜欢

The financing demand of 129 million yuan was released, and the roadshow of the Dake city project continued to irrigate the "good seedlings" of scientific innovation

Chapter 3 business function development (deletion and modification of clue remarks)

Read the recent trends of okaleido tiger and tap the value and potential behind it

How to guarantee password security? How does the secure browser manage passwords?

Pointer - golden stage

响应式织梦模板酒店客房类网站

Awvs cannot start problem

Servlet三种实现方式

Transform okhttp cache with retrofit

Responsive dream weaving template home decoration website
随机推荐
快速掌握Nodejs安装以及入门
Responsive dream weaving template outdoor camping website
Transform okhttp cache with retrofit
Jetpack -- understand the use of ViewModel and livedata
ES2022 的 8 个实用的新功能
Full solution of 3D model format | including more than 70 kinds of RVT, 3ds, DWG, FBX, IFC, osgb, obj, etc
响应式织梦模板酒店客房类网站
PS + PL heterogeneous multicore case development manual for Ti C6000 tms320c6678 DSP + zynq-7045 (2)
Read the recent trends of okaleido tiger and tap the value and potential behind it
如何快速设计一套支持渲染富文本内容的跨端组件
Day 14: continued day 13 label related knowledge
外包公司“混”了2年,我只认真做了5件事,如今顺利拿到字节 Offer。
响应式织梦模板户外露营类网站
Talk about the implementation principle of feign
2022/07/28 学习笔记 (day18) 常用API
ES6 语法扩展
fopen、_ Wfopen reads Unicode encoded files
Pointer - golden stage
工程经济学知识点总结
Practice and experience of security compliance in instant messaging scenarios