-
Notifications
You must be signed in to change notification settings - Fork 0
performance
Joe Huss edited this page Nov 10, 2022
·
1 revision
###Legacy Framework Request Processing Flow
- nginx/apacheReceive Requests
- nginx/apachePass the request tophp-fpm
- php-fpmInitializing the environment, such as creating a list of variables
- php-fpmCall individual extensions/modulesRINIT
- php-fpmdisk read php files
- php-fpmLexical analysis, syntax analysis, compile toopcode
- php-fpmExecute opcode include8.9.10.11
- Framework initialization, such as instantiating various classes, including such as containers, controllers, routes, intermediate keys, etc.。
- Framework connection database、redis
- Framework to execute business logic
- framework close database、redis
- php-fpmRelease resources, destroy all class definitions, instances, destroy symbol table, etc.
- php-fpmCall the RSHUTDOWN method of each extension/module in sequence
- php-fpmForward the result tonginx/apache
- nginx/apacheReturn the result to the client
There are 5 main reasons for the poor performance of traditional frameworks
- php-fpmOverhead to initialize everything at the beginning of the request and destroy everything at the end of the request
- php-fpmRead multiple php files from disk per request, repeated lexical syntax parsing, repeated compilation into opcodes overhead (can be avoided with opcache))
- The framework repeatedly creates instances of framework-related classes and the initialization overhead
- The framework repeatedly connects to disconnected databases, redis, and other overheads
- nginx/apacheOwn overhead and communication overhead with php-fpm
###webmanthe request processing flow
- The framework receives requests
- Framework to execute business logic
- The framework returns the results to the client
Right,In the absence ofnginxProbably because you,Before the start3步。if you want to get from otherphpThe framework is only this,This makeswebmanPerformanceseveral times or even tens of times better than traditional frameworks。
Performancein the properties of techempower.com 第20wheel pressure measurement(The default used is)