当前位置:网站首页>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
边栏推荐
- PyTorch二分类时BCELoss,CrossEntropyLoss,Sigmoid等的选择和使用
- [12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!
- 实现一个博客系统----使用模板引擎技术
- Shanghai under layoffs
- 通过npm 或者 yarn安装依赖时 报错 出现乱码解决方式
- Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
- Stm32+bh1750 photosensitive sensor obtains light intensity
- 【leetcode周赛总结】LeetCode第 81 场双周赛(6.25)
- Is it OK to open the securities account on the excavation finance? Is it safe?
- maxcompute有没有能查询 表当前存储容量的大小(kb) 的sql?
猜你喜欢
Interview shock 62: what are the precautions for group by?
机器学习笔记 - 灰狼优化
爱可可AI前沿推介(7.5)
Coding devsecops helps financial enterprises run out of digital acceleration
[summary of leetcode weekly competition] the 81st fortnight competition of leetcode (6.25)
你童年的快乐,都是被它承包了
Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
Fr exercise topic - simple question
Drive brushless DC motor based on Ti drv10970
leetcode:881. lifeboat
随机推荐
IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
Is it OK to open the securities account on the excavation finance? Is it safe?
Interview shock 62: what are the precautions for group by?
Isn't it right to put money into the external market? How can we ensure safety?
CPU design practice - Chapter 4 practical task 2 using blocking technology to solve conflicts caused by related problems
Crud of MySQL
729. My schedule I: "simulation" & "line segment tree (dynamic open point) &" block + bit operation (bucket Division) "
漫画:程序员不是修电脑的!
Brief introduction of machine learning framework
P1451 求细胞数量/1329:【例8.2】细胞
机器学习框架简述
Cartoon: programmers don't repair computers!
裁员下的上海
Jmeter性能测试:ServerAgent资源监控
R 熵权法计算权重及综合得分
Drive brushless DC motor based on Ti drv10970
Easyocr character recognition
Fr exercise topic - simple question
开挖财上的证券账户可以吗?安全吗?