Home > Article > Operation and Maintenance > Is there much difference in performance between apache and nginx?
This is due to Nginx using the latest epoll (Linux 2.6 kernel) and kqueue (freebsd) network I/O model, while Apache The traditional select model is used. (Recommended learning: nginx tutorial)
Currently, Squid and Memcached under Linux that can withstand high concurrent access use the epoll network I/O model.
To handle the reading and writing of a large number of connections, the select network I/O model used by Apache is very inefficient.
The following uses a metaphor to analyze the difference between the select model used by Apache and the epoll model used by Nginx:
Assume you are studying in college, The dormitory building you live in has many rooms, and your friends are coming to find you.
select version The hostess will take your friends from room to room until they find you.
The epoll version of the dormitory aunt will first write down the room number of each student. When your friend comes, you only need to tell your friend which room you live in, without having to bring your friend with you personally. Searching the building for people.
If 10,000 people come and want to find their classmates who live in this building, it is self-evident who is more efficient in the select version or the epoll version of the dormitory aunt.
Similarly, in high-concurrency servers, polling I/O is one of the most time-consuming operations. It is also very clear which performance is higher between select and epoll.
The above is the detailed content of Is there much difference in performance between apache and nginx?. For more information, please follow other related articles on the PHP Chinese website!