[Java] differences between Apache server and Tomcat and integration

Source: Internet
Author: User

Tomcat is a free open-sourceSerlvet containerIt is a core project of the Apache Foundation's Jakarta project, developed by Apache, sun, and other companies and individuals. With Sun's participation and support,The latest Servlet and JSP specifications can always be reflected in Tomcat.

Tomcat is not justServlet ContainerIt also has the traditionalWeb ServerFunction: Process HTML pages. However, compared with Apache, Apache is inferior in processing static html. We can integrate Tomcat and Apache to let Apache process static html, while Tomcat processes JSP and servlet. For this integration, you only need to modify the configuration files of Apache and tomcat.
Apache is a web serverProgram, Can be used as a Web server, but only supports static Web pages, but dynamic web pages such as ASP, PHP, CGI, JSP cannot. If you want to run JSP in Apache, you need an interpreter to execute the JSP webpage. This JSP interpreter is tomcat.

In summary, both Tomcat and Apache can be used as Web servers, that is, as a web server separately, "httpd" to complete HTTP service requests and responses. However, in addition to processing HTML pages, Tomcat can also be used as a servelt container to parse JSP pages and servlets. However, the Apache server can only process HTML pages. That is to say, it only serves as a Web server. If you want to complete other functions, such as running PHP and JSP pages, you need to integrate the corresponding Web container.

As a Web server, when only processing HTML pages, the Apache server has better performance than tomcat. Therefore, the two are often combined. Generally, a large site combines tomcat with Apache. Apache is responsible for accepting all HTTP requests from the client, and then forwards servlets and JSP requests to Tomcat for processing. After Tomcat completes processing, it returns the response to Apache, and finally Apache returns the response to the client.

For how to integrate Apache HTTP Server and tomcat, see:

 Integrate Tomcat and Apache in Windows XP:

 Http://dev.csdn.net/article/73669.shtm

Tomcat and Apache server integration:

Http://xshq.javaeye.com/blog/354259

Three connection methods for Apache HTTP Server and tomcat:

Http://www.ibm.com/developerworks/cn/opensource/os-lo-apache-tomcat/

 Differences between web servers and application servers:

Web Server)
The Web server can parse the HTTP protocol (handles. When the Web server receives an HTTP request, it returns an HTTP Response (response), for example, sending back an HTML page. In order to process a request, the web server can respond to a static page or image, perform a page Jump (redirect), or send a dynamic response (dynamic response) to some other programs, such as CGI scripts, JSP (assumerver pages) scripts, Servlets, ASP (Active Server Pages) scripts, server-side) javascript, or some other server-side technologies. Regardless of their purpose, these server-side programs usually generate an HTML response (response) for browsers to browse.

You know, the web server's proxy model is very simple. When a request is sent to the Web server, it simply passes the request to a program that can process the request well: server scripts ). The Web server only provides an environment that can execute the server-side program and the response generated by the program. Server-side programs generally have functions such as transaction processing, database connectivity, and messaging.

Although the Web server does not support transaction processing or database connection pools, it can configure various strategies to implement fault tolerance and scalability ), for example, load balancing and caching ). Cluster Features (fetering-features) are often mistaken for only the proprietary features of application servers.

The Application Server)
According to our definition, as an application server, it exposes business logic to (expose) client applications through various protocols, including HTTP.The Web server mainly processes HTML sent to the browser for browsing, and the application server provides a way to access the business logic for the client application to use.An application uses this business logic just like calling a method of an object (or a function in a procedural language.

The client of the Application Server (including a graphical user interface (GUI) may run on a PC, a Web server, or even other application servers. The information that shuttles back and forth between the application server and its client is not limited to simple display tags. On the contrary, this information is the program logic ). It is precisely because this logic has obtained the form of (takes) data and method calls (CILS) rather than static html, so the client can use this exposed business logic as desired.

In most cases, the application server exposes the business logic (expose) to the client application through the application interface (API) of the component (component, for example, the EJB (Enterprise JavaBean) Component Model Based on J2EE (Java 2 platform, Enterprise Edition) application server. In addition, application servers can manage their own resources, such as gate-keeping duties, including security, transaction processing ), resource pooling and messaging ). Like web servers, application servers are configured with a variety of scalability and fault tolerance technologies.

Warning (caveats)


now, XML Web Services has confused the boundaries between application servers and web servers. By sending an XML payload to the server, the web server can now process data and response as much as the previous application server.
In addition, most application servers now contain Web servers, which means that the Web server can be considered as a subset of the Application Server (subset ). Although the application server contains the functions of the web server, developers seldom deploy the application server into a capacity: this function refers to the functions of both application servers and web servers ). On the contrary, if needed, they usually configure the Web server independently, before and after the application server. This feature separation helps improve performance (Simple Web requests won't affect application servers), separate configurations (dedicated web servers, clusters (clustering), and so on ), in addition, there is room for selection of the best products.

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.