当前位置:网站首页>大白话高并发(二)
大白话高并发(二)
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,机房不够就再加几个机房。
参考
边栏推荐
- R数据分析:cox模型如何做预测,高分文章复现
- Jerry's broadcast has built-in flash prompt tone to control playback pause [chapter]
- 【colmap】已知相机位姿情况下进行三维重建
- input_ delay
- Sorting operation partition, argpartition, sort, argsort in numpy
- 美国空军研究实验室《探索深度学习系统的脆弱性和稳健性》2022年最新85页技术报告
- Don't you know the relationship between JSP and servlet?
- 2022.6.28
- Can the applet run in its own app and realize live broadcast and connection?
- 代码质量管理
猜你喜欢

函数重入、函数重载、函数重写自己理解

变量、流程控制与游标(MySQL)

The first symposium on "quantum computing + application of financial technology" was successfully held in Beijing

Hazel engine learning (V)

VHDL实现任意大小矩阵加法运算

Ubuntu20 installation redisjson record
![[safe office and productivity application] Shanghai daoning provides you with onlyoffice download, trial and tutorial](/img/58/d869939157669891f369fb274d32af.jpg)
[safe office and productivity application] Shanghai daoning provides you with onlyoffice download, trial and tutorial

Lavel PHP artisan automatically generates a complete set of model+migrate+controller commands

Not All Points Are Equal Learning Highly Efficient Point-based Detectors for 3D LiDAR Point

Enumeration general interface & enumeration usage specification
随机推荐
2022.6.28
HDU ACM 4578 Transformation-> Segment tree - interval change
装饰设计企业网站管理系统源码(含手机版源码)
Another million qubits! Israel optical quantum start-up company completed $15million financing
Centerx: open centernet in the way of socialism with Chinese characteristics
Lost in the lock world of MySQL
The version control of 2021 version is missing. Handling method
【达梦数据库】添加自动收集统计信息的任务
What about SSL certificate errors? Solutions to common SSL certificate errors in browsers
unrecognized selector sent to instance 0x10b34e810
Household appliance industry under the "retail is king": what is the industry consensus?
Leetcode-02 (linked list question)
房费制——登录优化
【Swift】学习笔记(一)——熟知 基础数据类型,编码风格,元组,主张
Jerry's broadcast has built-in flash prompt tone to control playback pause [chapter]
“去虚向实”大潮下,百度智能云向实而生
Jericho is in non Bluetooth mode. Do not jump back to Bluetooth mode when connecting the mobile phone [chapter]
Depth analysis of compilation constants, classloader classes, and system class loaders
Install torch 0.4.1
Cocos2d-x box2d physical engine compilation settings