最近抽时间总结下对于该问题近期的排查过程和分析;
问题背景:
web服务器使用的是nginx + uwsgi 的架构;
近期发现服务器上偶然会出现 *** uWSGI listen queue of socket 4 full !!! (100/100) *** 这样的日志;并且很难重现,有时候出现一段时间会自己回归正常,如下图:
图1 uwsgi listen queue full
问题分析:
由于是线上不定时重现,并且自动会好,并且表面上看应该是listen 队列满的原因。排除是代码逻辑等问题,怀疑是 资源和访问方式问题导致的;
首先要在环境中复现这种情况,以便发现更深入的原因;
看到listen 队列自然会找到对应的系统调用 int listen(int fd, int backlog);
socket listen 的时候可以指定 backlog 详细请看下边的定义:
An incomplete connection queue, which contains an entry for each SYN that has arrived from a client for which the server is awaiting completion of the TCP three-way handshake. These sockets are in the SYN_RCVD state . A completed connection queue, which contains an entry for each client with whom the TCP three-way handshake has completed. These sockets are in the ESTABLISHED state. The backlog argument to the listen function has historically specified the maximum value for the sum of both queues.简单的说backlog 就是 已完成队列和等待完成队列和,所以如果程序压力大,不能及时的accept socket ,那么队列就可能会满,满了以后新来的connection 就建立不起来,这里用c 简单做了个验证,服务器端listen 后不进行accept ,backlog 设置为1 ,让客户端请求时,代码如下:
相关推荐
C语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言头文件 QUEUE.HC语言...
Queue机制
Queue与Topic的比较,学习JMS和activemq必须看的资料之一
proirity_queue性能分析源码 比较了三种queue:std::multimap、std::multiset、std::priority_queue 的性能
Linux内核IP Queue机制的分析Linux内核IP Queue机制的分析Linux内核IP Queue机制的分析Linux内核IP Queue机制的分析Linux内核IP Queue机制的分析
A very good book! You can loaddown then take it back home and Study!
THis is an example source code for the queue implemented by systemc.
本文分析了内核同步及互斥的几种机制Waitqueue、Event及Semaphore的实现,详细分析了其实现流程。Event及Semaphore本质上都是基于Waitqueue和自旋锁实现的。总结了静态定义及动态初始化数据结构的相关规则,这对于...
消息队列 Queue与Topic区别
1. Message Queue的角色 在你的Android程序里,新诞生一个线程,或称执行(Thread)时,并不会自动建立其Message Loop。 Android里并没有Global的Message Queue数据结构,例如,不同APK里的对象不能透过...
Queue-Queue-Queue
socket.listen(dispatch_get_global_queue(0, 0), backlog: 5) { println("Wait, someone is attempting to talk to me!") $0.close() println("All good, go ahead!") } 客户端: let ...
queue源码分析 c++ vs2019 cpp20 ,包含priority-queue ,未分析,附带上了
NULL 博文链接:https://nuysoft.iteye.com/blog/1189156
JMS中topic和queue两种实现方式
Yet another implementation of a lock-free circular array queue
Windows Messae Queue性能分析 MS-MQ使用方法,传输数据的详细性能分析,包括运行时间(传送和接收),CPU使用率,物理内存使用率等,并以CSV文件的形式进行出力。
delphi中关于队列的使用QUEUE,已在delphi7中调试通过。 学习queue的小例子。
描述:支持文件批量上传、选择图片直接上传到服务器显示在界面
queue.cpp -- function definitions for the Array implementation of a Queue