Why Nginx Outperforms Apache: A Deep Dive into Select vs Epoll I/O Models

An in‑depth comparison reveals how Nginx’s epoll‑based I/O model delivers higher concurrency, better efficiency, reduced memory copying, and non‑blocking operation, while Apache’s traditional select model is limited by FD_SETSIZE, linear scanning, and greater kernel‑user space copying overhead.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
Why Nginx Outperforms Apache: A Deep Dive into Select vs Epoll I/O Models

Nginx and Apache differ in I/O performance because they use different I/O models.

Apache – select model

Characteristics:

Maximum concurrent connections are limited by the number of file descriptors (FD) a process can open, defined by FD_SETSIZE (default 1024/2048), which caps the concurrency.

Efficiency drops linearly because select scans the entire FD set on each call; increasing FD_SETSIZE further reduces performance.

Kernel‑user space memory copying is required to notify the user space of FD events, leading to extra copying overhead.

Can cause blocking.

Nginx – epoll model

Characteristics:

Maximum concurrent connections are limited only by the system’s maximum open files (e.g., /proc/sys/fs/file-max), typically far larger than 2048 and dependent on available memory.

Efficiency is higher because epoll monitors only active connections, independent of total connection count.

Uses shared memory to avoid kernel‑user space copying, eliminating that overhead.

Operates in non‑blocking mode.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendNGINXApacheepollselectI/O modelweb server performance
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.