A faster Web server: ripping out Apache for Nginx
Nov 14, 2011, 13:01 (1 Talkback[s])
(Other stories by Lee Hutchinson)
Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers
"Nginx (pronounced 'engine-ex') is a lightweight Web server with
a reputation for speed, speed, speed. It differs from Apache in a
fundamental way—Apache is a process- and thread-driven
application, but Nginx is event-driven. The practical effect of
this design difference is that a small number of Nginx 'worker'
processes can plow through enormous stacks of requests without
waiting on each other and without synchronizing; they just 'close
their eyes' and eat the proverbial elephant as fast as they can,
one bite at a time.
"Apache, by contrast, approaches large numbers of requests by
spinning off more processes to handle them, typically consuming a
lot of RAM as it does so. Apache looks at the elephant and thinks
about how big it is as it tucks into its meal, and sometimes Apache
gets a little anxious about the size of its repast. Nginx, on the
other hand, just starts chomping.
"The difference is summed up succinctly in a quote by Chris Lea
on the Why Use Nginx? page: 'Apache is like Microsoft Word, it has
a million options but you only need six. Nginx does those six
things, and it does five of them 50 times faster than Apache.'"