当前位置:网站首页>大白话高并发(二)
大白话高并发(二)
2022-07-06 20:21:00 【你大晨哥】
背景
这是三高专题的第二篇,我想了很久应该怎么去串联这个专题,后来我觉得就按照流量的方向来聊吧,从用户请求到服务端再到用户。
突然间来了200万个请求
我们一台服务器能承受住200万个请求么?答,可以,但是有条件只能是三次握手后的空链接,我们知道linux中一切皆文件,因此一个请求对一个linux来说也是一个文件fd,那只要我的linux文件数量足够大就可以接收200万个请求,一个请求默认为4k,200w * 4k 不过8M左右的内存是没有问题的,但是前提这些都是空链接,如果客户端发送了大量的数据到服务端,服务端又需要通过做cpu做大量的计算,处理后又将大量的数据返回给客户端,那样别说2000万,1000都是费劲的。
对于我们秒杀这种场景来说,单台机器不可能承受200万个请求,因此需要引入负载均衡。将请求路由到多个地方。
NGINX
首先我想到了nginx,nginx是7层的负载均衡,并发量大概在5w左右,如果想支撑200万并发,需要有40个nginx才行。
LVS 或者 F5服务器
一台nginx 5万并发,因此需要在nginx上面再来一层4层负载均衡,都说lvs并发在几十万,假设为20万,需要10台lvs。
DNS负载均衡
一台lvs看样子还是不能承受200万并发,看来在他的上面还需要一层,这一层就是DNS,通过ip来做负载均衡,一个lvs一个ip。
总结
上亿的并发也是这个套路,一层不够就再加一层,ip不够就再加几个ip,机房不够就再加几个机房。
参考
边栏推荐
- [untitled]
- About Tolerance Intervals
- 密码学系列之:在线证书状态协议OCSP详解
- Netperf and network performance measurement
- OC, OD, push-pull explanation of hardware
- Jericho is in non Bluetooth mode. Do not jump back to Bluetooth mode when connecting the mobile phone [chapter]
- Opencv environment, and open a local PC camera.
- 图形化工具打包YOLOv5,生成可执行文件EXE
- The first symposium on "quantum computing + application of financial technology" was successfully held in Beijing
- 源代码保密的意义和措施
猜你喜欢
The latest 2022 review of "small sample deep learning image recognition"
Stored procedures and functions (MySQL)
Create applet from 0
Graphical tools package yolov5 and generate executable files exe
Hazel engine learning (V)
VHDL实现任意大小矩阵乘法运算
Not All Points Are Equal Learning Highly Efficient Point-based Detectors for 3D LiDAR Point
杰理之播内置 flash 提示音控制播放暂停【篇】
CVPR 2022 best paper candidate | pip: six inertial sensors realize whole body dynamic capture and force estimation
Flink Task退出流程与Failover机制
随机推荐
24.(arcgis api for js篇)arcgis api for js点修改点编辑(SketchViewModel)
Tencent cloud native database tdsql-c was selected into the cloud native product catalog of the Academy of communications and communications
[cpk-ra6m4 development board environment construction based on RT thread studio]
腾讯云原生数据库TDSQL-C入选信通院《云原生产品目录》
Lavel PHP artisan automatically generates a complete set of model+migrate+controller commands
HDU 4337 King Arthur's Knights 它输出一个哈密顿电路
【Swift】学习笔记(一)——熟知 基础数据类型,编码风格,元组,主张
Flutter3.0, the applet is not only run across mobile applications
杰理之RTC 时钟开发【篇】
Jerry's phonebook acquisition [chapter]
Stored procedures and functions (MySQL)
[C language] question set of IX
美国空军研究实验室《探索深度学习系统的脆弱性和稳健性》2022年最新85页技术报告
Function reentry, function overloading and function rewriting are understood by yourself
Graphical tools package yolov5 and generate executable files exe
枚举通用接口&枚举使用规范
input_delay
【达梦数据库】添加自动收集统计信息的任务
Shell programming basics
存储过程与函数(MySQL)