The difference between LVS and Nginx

  1. nginx work at Layer 7 of the network, so it can do for http traffic policy application itself, such as for the domain name, directory structure, compared lvs do not have this feature, so nginx This in itself can be utilized lvs could outnumber the case; however, these features make it useful nginx adjustable degree than lvs, so often go to touch the touch, by section 2 lvs advantages of view, the multi-touch, appear artificial the chance of the problem also will be larger.

  2. nginx less dependent on the network, in theory, as long as the ping was through, the normal web access, you can even get through nginx, nginx distinction between internal and external networks while, at the same time owning node if it is outside the network, you have the equivalent of a stand-alone backup line; lvs is more dependent on the network environment, the present situation in the same network segment and the server using the direct method, lvs diversion effect than can be guaranteed. Also note, lvs need to apply to the custodian to do at least one more ip Visual
    ip, seemingly can not do with a VIP ip province. Lvs administrator to do, really have to follow up learning a lot of knowledge about network communications, it is no longer a http so simple.

  3. nginx is relatively simple to install and configure, test is also very convenient because it can basically wrong with the log printed out. lvs installation and configuration, testing would take a long time, because of the above, lvs dependent on the network is relatively large, often can not succeed because of a network configuration issue and not a configuration problem, a problem to be solved accordingly It will be more trouble.

  4. nginx is also able to withstand very high loads and stable, but the stability of the load of the very poor lvs there are several levels: nginx handles all traffic so limited by the IO and machine configuration; bug itself is still difficult to avoid; no ready nginx the dual hot standby program, so the risk is still relatively large single run, on a stand-alone all things is hard to say.

  5. nginx can detect faults internal server, such as web server processing according to the status code returned, to time out, and will return an error to resubmit the request to another node. Currently lvs in ldirectd also support for the internal server to monitor, but the principle of lvs it can not resend request. This retransmission request, such as user is uploading a file, and the processing node fails immediately uploaded during the upload process, Nginx will upload to another server re-cut process, the directly lvs cut off, if it is upload a large file or important documents, users may therefore annoyed.

  6. nginx request for asynchronous processing can help reduce the load on the server node, type using Apache direct foreign service, so a lot of narrow-band link Apache server will take up a lot of memory and can not be released, more than one Apache nginx proxy to do so, these narrowband Links will be blocked nginx, Apache will not pile on too many requests, thus reducing a considerable amount of memory footprint. This use squid also have the same effect, even if the squid itself is configured to not cache, Apache is still a great help to you. lvs without these features, it can not be compared.

  7. nginx supports http and Email (Email functionality is estimated fewer people use), lvs applications supported on this point too will be more than nginx.
    In use, the general strategy adopted by most front-end should be lvs, dns is pointing should lvs equalizer, another advantage lvs it is very suitable for this task.
    Important ip address, best left lvs hosting, such as database ip, webservice server ip and so on, these ip addresses with the passage of time, the use of surface will grow, if the failure to replace the ip will follow. So to these important lvs ip hosted the most secure, the only drawback is the need to do so will be more number of VIP.
    lvs node may be used as nginx machine, one can use nginx function, and second, may be utilized nginx performance. Of course, this level can also be used as squid, squid function on a lot weaker than nginx, performance is also somewhat inferior to nginx.
    nginx can also use as a mid-level agency, this level nginx essentially unopposed, the only way to shake the nginx only lighttpd, but not yet able to do lighttpd fully functional nginx, configuration is not so clear and easy to read. In addition, mid-level proxy ip is also important, so middle-level agency industry has a VIP and lvs is the perfect solution.
    nginx server can also be used as a static web page.
    Specific applications have specific analysis, if it is a relatively small site (Japanese pv <1000 million), with nginx is entirely possible, if the machine a lot, you can use dns poll, lvs-consuming machines, or more ; large sites or important services, the machine does not worry about a lot of time to consider using lvs.

Published 35 original articles · won praise 11 · views 2942

Guess you like

Origin blog.csdn.net/weixin_45697805/article/details/103939365