Key constraints in web server design
Nginx’s architectural design
Event-driven architecture
Events are generated by some event sources and collected and distributed by one or more event collectors. Then many event processors will register the events they are interested in and "consume" these events.
Multi-stage asynchronous processing of requests
Multi-stage asynchronous processing of requests can only be implemented based on event-driven architecture.
Divide a request processing process into multiple stages according to the event triggering method, and each stage can be triggered by event collectors and distributors.
Platform-independent code implementation
Implemented in C language, try to minimize the use of code related to the operating system platform.
Nginx re-encapsulates logs, various basic data structures, common algorithms and other tool software.
The core code is implemented using code that is independent of the operating system, and system calls related to the operating system have independent implementations for each operating system.
Memory pool design
Consolidating multiple operations of requesting memory from the system into one operation greatly reduces the consumption of CPU resources and reduces memory fragmentation.
HTTP filtering module using unified pipeline filter mode
Some other user modules
The core structure ngx_cycle_t in the Nginx framework
The above has introduced the Nginx infrastructure, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.