Projects: Linux scalability: Accept() scalability on Linux 惊群效应
小结:
1、不必要的唤醒
惊群效应
https://github.com/benoitc/gunicorn/issues/792#issuecomment-46718939
https://www.citi.umich.edu/u/cel/linux-scalability/reports/accept.html
http://stackoverflow.com/questions/12494914/how-does-the-operating-system-load-balance-between-multiple-processes-accepting/12502808#12502808
https://www.citi.umich.edu/u/cel/linux-scalability/reports/accept.html
Introduction
Network servers that use TCP/IP to communicate with their clients are rapidly increasing their offered loads. A service may elect to create multiple threads or processes to wait for increasing numbers of concurrent incoming connections. By pre-creating these multiple threads, a network server can handle connections and requests at a faster rate than with a single thread.
In Linux, when multiple threads call accept() on the same TCP socket, they get put on the same wait queue, waiting for an incoming connection to wake them up. In the Linux 2.2.9 kernel (and earlier), when an incoming TCP connection is accepted, the wake_up_interruptible() function is invoked to awaken waiting threads. This function walks the socket's wait queue and awakens everybody. All but one of the threads, however, will put themselves back on the wait queue to wait for the next connection. This unnecessary awakening is commonly referred to as a "thundering herd" problem and creates scalability problems for network server applications.
This report explores the effects of the "thundering herd" problem associated with theaccept() system call as implemented in the Linux kernel. In the rest of this paper, we discuss the nature of the problem and how it affects the scalability of network server applications running on Linux. Finally, we will benchmark the solutions and give the results and description of the benchmark. All benchmarks and patches are against the Linux 2.2.9 kernel.
Conclusion
By thoroughly studying this "thundering herd" problem, we have shown that it is indeed a bottleneck in high-load server performance, and that either patch significantly improves the performance of a high-load server. Even though both patches performed well in the testing, the "wake one" patch is cleaner and easier to incorporate into new or existing code. It also has the advantage of not committing a task to "exclusive" status before it is awakened, so extra code doesn't have to be incorporated for special cases to completely empty the wait-queue. The "wake one" patch can also solve any "thundering herd" problems locally, while the "task exclusive" method may require changes in multiple places where the programmer is responsible for making sure that all adjustments are made. This makes the "wake one" solution easily extensible to all parts of the kernel.
Projects: Linux scalability: Accept() scalability on Linux 惊群效应的更多相关文章
- Linux惊群效应详解
Linux惊群效应详解(最详细的了吧) linux惊群效应 详细的介绍什么是惊群,惊群在线程和进程中的具体表现,惊群的系统消耗和惊群的处理方法. 1.惊群效应是什么? 惊群效应也有人 ...
- UNIX 历史问题 分布式系统的Thundering Herd效应 惊群效应
https://uwsgi-docs.readthedocs.io/en/latest/articles/SerializingAccept.html One of the historical pr ...
- uWSGI Apache 处理 惊群效应的方式 现代的内核
Serializing accept(), AKA Thundering Herd, AKA the Zeeg Problem — uWSGI 2.0 documentationhttps://uws ...
- Linux网络编程“惊群”问题总结
1.前言 我从事Linux系统下网络开发将近4年了,经常还是遇到一些问题,只是知其然而不知其所以然,有时候和其他人交流,搞得非常尴尬.如今计算机都是多核了,网络编程框架也逐步丰富多了,我所知道的有多进 ...
- accept与epoll惊群 转载
今天打开 OneNote,发现里面躺着一篇很久以前写的笔记,现在将它贴出来. 1. 什么叫惊群现象 首先,我们看看维基百科对惊群的定义: The thundering herd problem occ ...
- “惊群”,看看nginx是怎么解决它的
在说nginx前,先来看看什么是“惊群”?简单说来,多线程/多进程(linux下线程进程也没多大区别)等待同一个socket事件,当这个事件发生时,这些线程/进程被同时唤醒,就是惊群.可以想见,效率很 ...
- 【转载】“惊群”,看看nginx是怎么解决它的
原文:http://blog.csdn.net/russell_tao/article/details/7204260 在说nginx前,先来看看什么是“惊群”?简单说来,多线程/多进程(linux下 ...
- nginx&http 第三章 惊群
惊群:概念就不解释了. 直接说正题:惊群问题一般出现在那些web服务器上,Linux系统有个经典的accept惊群问题,这个问题现在已经在内核曾经得以解决,具体来讲就是当有新的连接进入到accept队 ...
- Nginx学习之一-惊群现象
惊群问题(thundering herd)的产生 在建立连接的时候,Nginx处于充分发挥多核CPU架构性能的考虑,使用了多个worker子进程监听相同端口的设计,这样多个子进程在accept建立新连 ...
随机推荐
- hive 存储格式对比
Apache Hive支持Apache Hadoop中使用的几种熟悉的文件格式,如TextFile,RCFile,SequenceFile,AVRO,ORC和Parquet格式. Cloudera I ...
- 【Zookerper】 安装开启
一.Windows环境 1.1 下载和安装: 1.2 开启 1.3 关闭 1.4 用客户端连接 二.Linux 环境 一.Windows环境 1.1 下载和安装: 环境要求:必须要有jdk环境 1.安 ...
- Vue-Cli3.0 单页面如何预渲染,解决登录拦截导致无法部分路由无法预渲染问题?
vue单页面不利于seo,如何解决已有spa项目seo问题? 1.安装 cnpm install prerender-spa-plugin --save-dev 2.路由history模式 const ...
- webpack 配置react脚手架
1 react 基本js文件: import React from 'react'; import ReactDOM from 'react-dom'; import App from './App. ...
- 多线程锁:Mutex互斥体,Semaphore信号量,Monitor监视器,lock,原子操作InterLocked
Mutex类 “mutex”是术语“互相排斥(mutually exclusive)”的简写形式,也就是互斥量.互斥量跟临界区中提到的Monitor很相似,只有拥有互斥对象的线程才具有访问资源的权限, ...
- vulkan的subpass
最近在写 unity上 vulkan开subpass 似乎pc上subpass 的input attachement hlslcc_fbinput_0绑不上的 在手机上能绑上 说明subpass这个功 ...
- Greenplum实战之查询优化
本文主要分为三部分: GP优化需要准备的一些关于优化之外的知识,包括清空缓存.性能监控.执行计划分析. 具体优化措施,从以下四个方面考虑: 表.字段 sql GP配置.服务器配置 硬件及节点资源 GP ...
- Android系统输入事件分发详解
什么是输入事件? 我们知道,运行android系统的设备本质上是一台计算机,使用者在和计算机进行交互的时候可以抽象成简单的对计算机的输入和输出(IO).那么对于运行在计算机上的操作系统来说,操作系统在 ...
- 牛客练习赛51 D题
链接:https://ac.nowcoder.com/acm/contest/1083/D来源:牛客网 有一个草原可以用一个1~400的数轴表示.有n头羊和q个查询.每头羊的编号分别是1,2,3…n. ...
- change([[data],fn]) 当元素的值发生改变时,会发生 change 事件。
change([[data],fn]) 概述 当元素的值发生改变时,会发生 change 事件.大理石平台价格表 该事件仅适用于文本域(text field),以及 textarea 和 select ...