当前位置:网站首页>PHP high concurrency and large traffic solution (PHP interview theory question)
PHP high concurrency and large traffic solution (PHP interview theory question)
2022-07-05 14:59:00 【Back end regular developers】
Catalog
PHP High concurrency and high traffic solutions
One 、 The concept of high concurrency
In the age of the Internet , Concurrent , High concurrency usually refers to concurrent access . At some point in time , How many visits come at the same time .
Two 、 Concepts related to high concurrency Architecture
1、QPS ( Query rate per second ) : The number of requests or queries per second , In the field of Internet , It refers to the number of response requests per second ( finger HTTP request )
2、PV(Page View): Comprehensive views , That is, page views or clicks , A visitor is in 24 Number of pages visited in hours
– notes : The same person browsing the same page of your website , Just remember to do it once pv
3、 throughput (fetches/sec) : Number of requests processed per unit time ( Usually by QPS And concurrency )
4、 response time : The time from the request to the response
5、 Independent visitor (UV): Within a certain time frame , The same visitors visit the website many times , Only calculated as 1 An independent visitor
6、 bandwidth : There are two indicators to pay attention to when calculating bandwidth , Peak traffic and average page size
7、 Daily website bandwidth : PV/ Count the time ( Convert to seconds ) * Average page size (kb)* 8
3、 ... and 、 You need to pay attention to :
1、QPS Not equal to the number of concurrent connections (QPS Every second HTTP Number of requests , The number of concurrent connections is the number of requests processed by the system at the same time )
2、 Peak requests per second (QPS)= ( total PV Count 80%)/ ( Six hours and seconds 20%)【 representative 80% All of our visits are focused on 20% In time 】
3、 Pressure test : Test the maximum number of concurrent that can be tolerated And test the most bearable QPS value
4、 Common performance testing tools 【ab,wrk,httpload,Web Bench,Siege,Apache JMeter】
Four 、 Optimize
1、 When QPS Less than 50 when
Optimization plan : For general small websites , Don't think about optimization
2、 When QPS achieve 100 when , Encountered data query bottleneck
Optimization plan : Database cache layer , Database load balancing
3、 When QPS achieve 800 when , Bandwidth bottleneck
Optimization plan :CDN Speed up , Load balancing
4、 When QPS achieve 1000 when
Optimization plan : do html Static cache
5、 When QPS achieve 2000 when
Optimization plan : Do business separation , Distributed storage
5、 ... and 、 High concurrency solution cases :
- Traffic optimization
Anti theft chain handling ( Remove malicious requests )
- Front end optimization
- Reduce HTTP request [ take css,js Etc ]
- Add asynchronous request ( Don't show all the data to the user first , The user triggers an event , To request data asynchronously )
- Enable browser caching and file compression
- CDN Speed up
- Set up an independent image server ( Reduce I/O)
- Server optimization
- Page static
- Concurrent processing
- Queue processing
- Control large file downloads , It is recommended to put large files on another server
- Database optimization
- Database cache
- Sub database and sub table , Partition
- Read / write separation
- Load balancing
- Try not to query select *
- Avoid related subqueries
- Add indexes to frequently queried
- web Server optimization
- nginx Reverse agent to achieve load balancing
- lvs Load balancing
边栏推荐
- FR练习题目---综合题
- NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
- PyTorch二分类时BCELoss,CrossEntropyLoss,Sigmoid等的选择和使用
- 漫画:程序员不是修电脑的!
- Run faster with go: use golang to serve machine learning
- Want to ask the big guy, is there any synchronization from Tencent cloud Mysql to other places? Binlog saved by Tencent cloud MySQL on cos
- 用 Go 跑的更快:使用 Golang 为机器学习服务
- 裁员下的上海
- 做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史
- Photoshop plug-in action related concepts actionlist actiondescriptor actionlist action execution load call delete PS plug-in development
猜你喜欢
P6183 [USACO10MAR] The Rock Game S
Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
B站做短视频,学抖音死,学YouTube生?
超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜
MongDB学习笔记
How to choose the appropriate certificate brand when applying for code signing certificate?
两个BI开发,3000多张报表?如何做的到?
面试突击62:group by 有哪些注意事项?
Interpretation of Apache linkage parameters in computing middleware
Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
随机推荐
注意!软件供应链安全挑战持续升级
【NVMe2.0b 14-9】NVMe SR-IOV
There is a powerful and good-looking language bird editor, which is better than typora and developed by Alibaba
I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
MySQL之CRUD
CPU design related notes
Fr exercise topic --- comprehensive question
Mongdb learning notes
在Pytorch中使用Tensorboard可视化训练过程
GPS original coordinates to Baidu map coordinates (pure C code)
[detailed explanation of Huawei machine test] character statistics and rearrangement
Selection and use of bceloss, crossentropyloss, sigmoid, etc. in pytorch classification
ICML 2022 | 探索语言模型的最佳架构和训练方法
【招聘岗位】软件工程师(全栈)- 公共安全方向
CODING DevSecOps 助力金融企业跑出数字加速度
Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
How to choose the appropriate certificate brand when applying for code signing certificate?
I collect multiple Oracle tables at the same time. After collecting for a while, I will report that Oracle's OGA memory is exceeded. Have you encountered it?
计算中间件 Apache Linkis参数解读
webRTC SDP mslabel lable