What is the difference between Tomcat and Nginx,apache HTTP Server Project

Source: Internet
Author: User
Tags python simplehttpserver nginx load balancing
This article mainly introduces the difference between Tomcat and Nginx,apache HTTP Server Project, has a certain reference value, now share to everyone, the need for friends can refer to

Apache, which refers to a project under the Apache Software Foundation--apache HTTP Server Project;nginx is also an open source HTTP Server Software (it can also be used as a mail proxy, a generic TCP proxy server, of course).
An HTTP server is essentially an application-it usually runs on the server, binds the server's IP address and listens on a TCP port to receive and process HTTP requests, so the client (ie, Firefox, generally A browser such as chrome can get the Web page (HTML format), the document (PDF format), audio (MP4 format), video (mov format) and other resources on the server via the HTTP protocol.
This process is described:

Not only Apache HTTP server and Nginx, the majority of programming languages contained in the class library also implemented a simple HTTP server for developers to use: Httpserver (Java HTTP server) Python Simplehttpserver using these class libraries makes it very easy to run an HTTP server that provides HTTP services by binding IP addresses and listening to TCP ports.
Apache Tomcat is another project under the Apache Foundation where Tomcat can dynamically generate resources and return to the client, compared to Apache HTTP server. Apache HTTP server and Nginx are able to return the content of a text file to the client through the HTTP protocol, but the content of the text file is fixed-that is, whenever and whenever anyone accesses it, the content is exactly the same, such resources we call Static Resources .
Dynamic resources In contrast, the content is different at different times, different client access, for example: The page containing the current time displays the current IP address of the page Apache HTTP Server and Nginx itself does not support the generation of dynamic pages, However, they can be supported by other modules (e.g., dynamically generated content through shell, PHP, and Python scripts). This type of HTTP server is difficult to use if you want to use Java programs to dynamically generate resource content. Java servlet Technology and the derived Java Server pages technology allow Java programs to also have the ability to handle HTTP requests and return content (dynamically controlled by the program), which Tomcat supports to run servlet/ A container for JSP applications (Container):

Tomcat runs on top of the JVM, which, like an HTTP server, binds IP addresses and listens to TCP ports, along with the following accusations:

    • Managing the life cycle of a servlet program

    • Map URLs to the specified servlet for processing

    • Working with the Servlet program to process HTTP requests-generating HttpServletResponse objects based on HTTP requests and passing them to the servlet for processing. Returns the content generated by the HttpServletResponse object in the servlet to the browser

Although Tomcat can also be considered an HTTP server, it is usually used in conjunction with Nginx: Static and dynamic resource separation--using Nginx's reverse proxy function to distribute requests: All dynamic resource requests are given to Tomcat, while static resource requests (example slices, video, CSS, JavaScript files, etc.) are returned directly from Nginx to the browser, which can greatly reduce the pressure on Tomcat. Load balancing, when the business pressure increases, perhaps a tomcat instance is not enough to handle, then you can start multiple Tomcat instances to scale horizontally, and the Nginx load balancing function can distribute the request through the algorithm to various instances for processing.

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

Related Article

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.