Supplement · Nginx

Architecture và event loop

Nginx dùng một master process quản cấu hình, bind socket và lifecycle; nhiều worker process xử lý traffic. Mỗi worker dùng non-blocking I/O và event notification (epoll/kqueue), nên một worker có thể theo dõi nhiều connection mà không cần một thread cho mỗi connection.

Mental model

Failure mode: tăng worker_connections nhưng quên worker_rlimit_nofile/OS limit tạo lỗi “too many open files”; CPU thấp không có nghĩa không saturation.

Evidence nên thu

Active connections, accepts/handled/requests, worker CPU, open FDs, listen queue, error log và upstream concurrency phải cùng timeline.

Nguồn chính thức