ELM 2007/11/5 23:29
Nginx - Small, But Very Powerful and Efficient Web Server
Today, I want to describe one of the interesting tools I am using in my job. This tool is nginx - small, but very powerful and efficient web server created by Igor Sysoev for large Russian web company Rambler and kindly provided by open-source community. This server can be used as standalone HTTP-server and as reverse proxy server before some Apache or another “big” server” to reduce load to backend server by many concurrent HTTP-sessions. As standalone web server, nginx can easily handle huge http-load on static files (images, html-pages, etc).
Main features of nginx server:
* Handling requests to static content, automatical handling of index files and building directory listings.
* Accelerated proxying without caching, simple load banancing and fail-over.
* Accelerated support of remote FastCGI servers with simple load banancing and fail-over.
* Modules and filters including compression (gzip), byte-ranges, chunked responses, SSI-filter, concurrently executed FastCGI or proxy subrequests from one SSI-page.
* SSL-support.
Advanced features of nginx server:
* IP-based and name-based virtual servers.
* Support for keep-alive and pipelined connections.
* Flexible configurations like in Apache, tunable timeouts and buffers.
* Config file and even executable file updating without any termination in service.
* Tunable log files with fast rotation.
* Special pages for errors 400-599.
* Very efficient URI rewriting with regular expressions.
* Access rules based on client’s IP address and on pasword (Basic auth).
* Download speed limits.
Main architecture specifics of nginx server:
* One management and many worker processes; workers are running from non-privileged user.
* Support for different techniques for asynchronous sockets handling: kqueue (FreeBSD 4.1+), epoll (Linux 2.6+), rt signals (Linux 2.2.19+), /dev/poll (Solaris 7 11/99+), select and poll.
* sendfile() system call support: sendfile (FreeBSD 3.1+), sendfile (Linux 2.2+), sendfile64 (Linux 2.4.21+) and sendfilev (Solaris 8 7/01+).
* Accept-filters support on FreeBSD 4.1+ and TCP_DEFER_ACCEPT on Linux 2.4+.
* Very efficient memory handling: it needs only 2.5Mbytes of RAM for 10000 inactive keep-alive connections.
* Minimum of memory copying operations
As an experimental feature, perl interpreper integration can be turned on in nginx.
As for my job, we are using nginx as a primary software for free hosting platforms. I have developed specific modules for banner inserting and stats calculation in nginx and now our central server can handle about 150-200Mbit/s of highly fragmented http-traffic (all files are small). I think, this is really good result bacause with any possible tunnings of Apache on the same servers we were not able to handle even 60-80Mbit/s.
IMHO, main problem of this server is lack of English documentation. As far as i know, its author is really busy and have no time to translate documentation to English. I hope, this article gave you main ideas of what nginx is and why I think that it is the best of lightweight http-servers in the world. ;-)
digg story
From: [url]http://blog.kovyrin.net/2006/04/04/nginx-small-powerful-web-server/[/url]