当前位置:网站首页>Max of PHP FPM_ Some misunderstandings of children
Max of PHP FPM_ Some misunderstandings of children
2022-07-03 18:42:00 【Brother Xing plays with the clouds】
Now? nginx + fpm Basically become the mainstream configuration , What we pay more attention to is pm.max_chindren Configuration of
First , We focus on a premise setting : pm = static/dynamic,
This option is identification fpm Generation mode of subprocess :
static : It means that fpm The runtime directly fork Out pm.max_chindren individual worker process ,
dynamic: Express , Runtime fork Out start_servers A process , As the load increases , Dynamic adjustment , Not more than max_children A process .
Generally recommended static, The advantage is that there is no need to dynamically judge the load , Lifting performance , The disadvantage is to occupy more system memory resources .
The above tells us max_chindren Representative worker The number of processes . It is generally believed that , The more this configuration is, the more concurrency it can handle at the same time , This is a big mistake :
1) Look at the fpm Related source code , Manage processes and worker The process is through pipe For data communication . So there are many processes , Increase the overhead of process management , Overhead of system process switching , More importantly , Can be executed concurrently fpm The process will not exceed cpu Number . By opening more worker To increase the number of qps, It's a misunderstanding , I won't say that you have opened several more processes , Just a few more cpu To deal with it .
2) but worker Less progress , If server If you are busy , It leads to nginx Type the data to fpm When , Find all woker All at work , There is no free worker To accept the request , Which leads to 502.
that worker How to configure numbers ?
Theoretically woker Number of processes =cpu The number of is the most reasonable , But because of the 2 Reason for point , Maybe each worker Didn't finish processing the request , such , It will appear frequently 502 了 . But ask more , Just say avoid 502, Temporarily put the request hang live , But this is only the way to alleviate , In fact, this will not increase the concurrency of the system , And it will increase the load of the system , therefore , Set a reasonable worker Number is more important .
Martial arts in the world , Fast break not only , Only try to improve the efficiency of the program , Minimize the time of a single request , such , Single worker The processing time of is shortened , There are naturally more requests that can be processed in unit time .
Then you can pass each worker Estimate the number of requests processed per unit time max_children The number of . Suppose the processing time of the largest request is 100ms Inside , And in the 100ms At the same time 100 Please come here , In theory, it needs to be configured 100 individual worker process , First give the request to hang live .
But the biggest request time may be affected by many external conditions , Not a good estimate , In fact, there is a shortcut , To configure your max_children Count , It's that you put max_childnren Set to a larger value , After a period of stable operation , Observe fpm Of status Inside max active processes How much is the , And then put max_children If the configuration is larger than him ok 了 .
I hope these articles can help you .
边栏推荐
- Unsafe类的使用
- What is the function of registering DLLs- What does registering a DLL do?
- Typescript official website tutorial
- 2022-2028 global plasmid DNA cdmo industry research and trend analysis report
- 2022-2028 global marking ink industry research and trend analysis report
- leetcode:11. 盛最多水的容器【双指针 + 贪心 + 去除最短板】
- Chisel tutorial - 06 Phased summary: implement an FIR filter (chisel implements 4-bit FIR filter and parameterized FIR filter)
- 2022-2028 global physiotherapy clinic industry research and trend analysis report
- 论文阅读 GloDyNE Global Topology Preserving Dynamic Network Embedding
- Use of unsafe class
猜你喜欢
Recommend a simple browser tab
my. INI file not found
Computer graduation project PHP library book borrowing management system
VLAN experiment
Caddy server agent
Shell script return value with which output
组策略中开机脚本与登录脚本所使用的用户身份
Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time
Su embedded training - Day10
How to track the real-time trend of Bank of London
随机推荐
G1 garbage collector of garbage collector
There are several levels of personal income tax
What problems can cross-border e-commerce sellers solve with multi platform ERP management system
Theoretical description of linear equations and summary of methods for solving linear equations by eigen
[combinatorics] generating function (positive integer splitting | unordered non repeated splitting example)
Briefly describe the quantitative analysis system of services
Data analysis is popular on the Internet, and the full version of "Introduction to data science" is free to download
[Godot] add menu button
199. Right view of binary tree - breadth search
ES7 - Optimization of promise
[leetcode周赛]第300场——6110. 网格图中递增路径的数目-较难
Computer graduation design PHP sports goods online sales system website
English语法_形容词/副词3级 - 倍数表达
Recommend a simple browser tab
Nodejs (01) - introductory tutorial
Web3 credential network project galaxy is better than nym?
2022-2028 global petroleum pipe joint industry research and trend analysis report
php-fpm的max_chindren的一些误区
Zhengda futures news: soaring oil prices may continue to push up global inflation
Closure and closure function