Comparison of the difference between Nginx and Apache and its advantages and disadvantages

Source: Internet
Author: User
Tags hosting

Most of the information in this paper is a excerpt of the Internet, and only to do is to integrate the scattered resources on the Internet and add their own a little insight. The simple thing is that Apache httpd and Nginx are Web servers, but the two adapt to different scenarios, that is, the two focus on solving different problems. Apache httpd: Stable, strong dynamic request processing, but at the same time high concurrency performance is weak, consuming more resources. Nginx: High concurrency processing ability, good at handling static requests, reverse proxy, balanced load.

1,nginx compared to the advantages of Apache: Lightweight, the same Web services, more than Apache to occupy less memory and resources, concurrency capability, Nginx processing requests are asynchronous non-blocking mode, and Apache is synchronous blocking mode, In high concurrency, nginx can keep low resource consumption high performance, highly modular design, writing modules relatively simple, community active, high-performance modules produced quickly.

Apche relative to the advantages of Nginx: Rewrite ability than nginx powerful, super-module, the basic thought can be found. Apache Bugs compared to nginx less, more stable. In General, Web services that require performance, with Nginx. If you don't need performance to be stable, then use Apache.

synchronous, asynchronous, blocking, and non-blocking differences:

(1) Synchronization: The so-called synchronization, that is, when a function call is issued, the call does not return until the result is obtained.

(2) Async: asynchronous concepts and synchronization are relative. When an asynchronous procedure call is made, the caller cannot get the result immediately. The part that actually handles the call notifies the caller via status, notification, and callback after completion .

(3) Blocking: A blocking call means that the current thread is suspended until the call results are returned. Functions are returned only after the result is obtained. One might equate blocking calls with synchronous invocations, in fact they are different. For synchronous calls, many times the current thread is still active, but logically the current function does not return.

(4) Non-blocking: The concept of non-blocking and blocking corresponds to a function that does not block the current thread and returns immediately until the result is not immediately available.

2,nginx configuration is simple, Apache configuration complex, nginx static processing performance than Apache 3 times times higher, but the dynamic processing request is weak. Apache support for PHP is relatively simple, nginx need to cooperate with other backend, Apache more than Nginx components, now Nginx is the preferred Web server.

        3,  nginx anti-and > The ability to do a lot better. (2) Nginx has less demand for resources.

4,nginx and Apache combined use. Nginx load capacity, high static processing performance, can be used as a front-end responsible for anti-concurrency, load balancing, do a static file cache, Apache is relatively stable, can be used as a back-end processing dynamic requests.

5. nginx processing Dynamic request is chicken, general dynamic request to Apache to do, nginx only suitable for static and reverse.

6. Nginx is superior to Apache's main two points: the 1.nginx itself is a reverse proxy server 2.nginx support 7 layer load balancing; Of course, nginx may support higher concurrency than Apache, but according to Netcraft statistics, April 2011 of statistics, Apache still occupies 62.71%, and Nginx is 7.35%, so in the first place, Apache remains the preferred choice for most companies.

7,nginx configuration file Concise, regular configuration so that many things become simple, high efficiency, less resources, proxy powerful, very suitable for the front-end response server.

8. as a WEB server: using fewer resources compared to Apache,nginx, supporting more concurrent connections and increasing efficiency, this makes Nginx particularly popular with virtual hosting providers. In the case of high connection concurrency, Nginx is a good alternative to Apache server: Nginx in the United States is a virtual hosting business owners often choose one of the software platform. Capable of supporting up to 50,000 concurrent connections, thanks to Nginx for choosing Epoll and Kqueue as the development model. Nginx as a Load Balancer server: Nginx can either directly support the internal Rails and PHP programs outside the service, also can support as an HTTP proxy server external services. Nginx is written in C, whether it is system resource overhead or CPU usage efficiency is much better than Perlbal. As a mail proxy server: Nginx is also a very good mail proxy server (one of the first to develop this product is also as a mail proxy server), Last.fm describes the success and the wonderful use of experience. Nginx is a very simple installation, the configuration file is very concise (also can support Perl syntax), Bugs very few servers: Nginx boot is particularly easy, and can be almost uninterrupted operation, even if the run for several months do not need to restart. You will also be able to upgrade the software version without interruption of service.

Comparison of the difference between Nginx and Apache and its advantages and disadvantages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.