当前位置:网站首页>大白话高并发(二)
大白话高并发(二)
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,机房不够就再加几个机房。
参考
边栏推荐
- ubuntu20安裝redisjson記錄
- 编译常量、ClassLoader类、系统类加载器深度探析
- 注意力机制原理
- Flutter3.0, the applet is not only run across mobile applications
- Cryptography series: detailed explanation of online certificate status protocol OCSP
- leetcode
- SSL证书错误怎么办?浏览器常见SSL证书报错解决办法
- [dream database] add the task of automatically collecting statistical information
- 杰理之开启经典蓝牙 HID 手机的显示图标为键盘设置【篇】
- Hazel engine learning (V)
猜你喜欢

Huawei and Xiaomi "copy each other"

Hazel engine learning (V)

Function reentry, function overloading and function rewriting are understood by yourself

CVPR 2022 best paper candidate | pip: six inertial sensors realize whole body dynamic capture and force estimation

Mathematical induction and recursion

装饰设计企业网站管理系统源码(含手机版源码)

20.(arcgis api for js篇)arcgis api for js面采集(SketchViewModel)

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

Centerx: open centernet in the way of socialism with Chinese characteristics

代码质量管理
随机推荐
杰理之RTC 时钟开发【篇】
房费制——登录优化
When you go to the toilet, you can clearly explain the three Scheduling Strategies of scheduled tasks
RestClould ETL 社区版六月精选问答
opencv环境的搭建,并打开一个本地PC摄像头。
The version control of 2021 version is missing. Handling method
Hazel engine learning (V)
Decoration design enterprise website management system source code (including mobile source code)
杰理之在非蓝牙模式下,手机连接蓝牙不要跳回蓝牙模式处理方法【篇】
【安全的办公和生产力应用程序】上海道宁为您提供ONLYOFFICE下载、试用、教程
Matlab Error (Matrix dimensions must agree)
CVPR 2022 最佳论文候选 | PIP: 6个惯性传感器实现全身动捕和受力估计
R数据分析:cox模型如何做预测,高分文章复现
pip只下载不安装
Laravel php artisan 自动生成Model+Migrate+Controller 命令大全
Basic concepts of Huffman tree
上个厕所的功夫,就把定时任务的三种调度策略说得明明白白
Principle of attention mechanism
Jericho is in non Bluetooth mode. Do not jump back to Bluetooth mode when connecting the mobile phone [chapter]
制作(转换)ico图标