当前位置:网站首页>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
边栏推荐
- Selection and use of bceloss, crossentropyloss, sigmoid, etc. in pytorch classification
- 【华为机试真题详解】欢乐的周末
- TS所有dom元素的类型声明
- I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
- Stm32+bh1750 photosensitive sensor obtains light intensity
- 当代人的水焦虑:好水究竟在哪里?
- Easyocr character recognition
- C language -- structure and function
- 注意!软件供应链安全挑战持续升级
- 【NVMe2.0b 14-9】NVMe SR-IOV
猜你喜欢

Fr exercise topic --- comprehensive question

Machine learning notes - gray wolf optimization

微帧科技荣获全球云计算大会“云鼎奖”!

【NVMe2.0b 14-9】NVMe SR-IOV

Interview shock 62: what are the precautions for group by?
![[detailed explanation of Huawei machine test] character statistics and rearrangement](/img/0f/972cde8c749e7b53159c9d9975c9f5.png)
[detailed explanation of Huawei machine test] character statistics and rearrangement

Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment

用 Go 跑的更快:使用 Golang 为机器学习服务

FR练习题目---综合题

Pointer operation - C language
随机推荐
[summary of leetcode weekly competition] the 81st fortnight competition of leetcode (6.25)
qt creater断点调试程序详解
STM32+BH1750光敏传感器获取光照强度
可转债打新在哪里操作开户是更安全可靠的呢
Fr exercise topic --- comprehensive question
easyOCR 字符识别
Photoshop plug-in - action related concepts - actions in non loaded execution action files - PS plug-in development
Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
Leetcode: Shortest Word Distance II
1330:【例8.3】最少步数
JMeter performance test: serveragent resource monitoring
[12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!
浅谈Dataset和Dataloader在加载数据时如何调用到__getitem__()函数
Run faster with go: use golang to serve machine learning
Mongdb learning notes
Fr exercise topic - simple question
计算中间件 Apache Linkis参数解读
开挖财上的证券账户可以吗?安全吗?
一键更改多个文件名字
maxcompute有没有能查询 表当前存储容量的大小(kb) 的sql?