当前位置:网站首页>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
边栏推荐
- 我这边同时采集多个oracle表,采集一会以后,会报oracle的oga内存超出,大家有没有遇到的?
- Is it OK to open the securities account on the excavation finance? Is it safe?
- Leetcode: Shortest Word Distance II
- 微帧科技荣获全球云计算大会“云鼎奖”!
- GPS原始坐标转百度地图坐标(纯C代码)
- 【華為機試真題詳解】歡樂的周末
- 1330:【例8.3】最少步数
- Machine learning notes - gray wolf optimization
- mysql8.0JSON_ Instructions for using contains
- Crud de MySQL
猜你喜欢
两个BI开发,3000多张报表?如何做的到?
Dark horse programmer - software testing -10 stage 2-linux and database -44-57 why learn database, description of database classification relational database, description of Navicat operation data, de
Under the crisis of enterprise development, is digital transformation the future savior of enterprises
Two Bi development, more than 3000 reports? How to do it?
Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜
Selection and use of bceloss, crossentropyloss, sigmoid, etc. in pytorch classification
浅谈Dataset和Dataloader在加载数据时如何调用到__getitem__()函数
Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
MongDB学习笔记
随机推荐
Mongdb learning notes
PostgreSQL 13 installation
注意!软件供应链安全挑战持续升级
Microframe technology won the "cloud tripod Award" at the global Cloud Computing Conference!
webRTC SDP mslabel lable
C language -- structure and function
Cartoon: programmers don't repair computers!
华为哈勃化身硬科技IPO收割机
【华为机试真题详解】字符统计及重排
[recruitment position] infrastructure software developer
Leetcode: Shortest Word Distance II
面试突击62:group by 有哪些注意事项?
Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
GPS original coordinates to Baidu map coordinates (pure C code)
Does maxcompute have SQL that can query the current storage capacity (KB) of the table?
漫画:程序员不是修电脑的!
CPU设计实战-第四章实践任务三用前递技术解决相关引发的冲突
Handwriting promise and async await
R 熵权法计算权重及综合得分
[detailed explanation of Huawei machine test] happy weekend