Differences between APACHE and tomcat

Source: Internet
Author: User

Apache is a web server environment program that can be used as a web server. However, dynamic web pages such as ASP, PHP, CGI, and JSP are powerless.
If you want to run JSP in Apache, you need an interpreter to execute the JSP web page. The JSP interpreter is tomcat. Why JDK? If JSP needs to connect to the database, JDK is required to provide a path to connect to the database. Therefore, Apache + Tomcat + JDK is required to run the JSP web server platform. However, the author believes that it is best not to have database access code on the JSP page. The JSP function is only used for display. Another reason for JDK is that Tomcat is implemented in Java.


If you want the server to handle dynamic pages, you need tomcat. Tomcat can parse JSP and servlet.

The advantages of Apache + Tomcat integration are:
Reference 1) if the client requests a static page, only the Apache server is required to respond to the request. If the client requests a dynamic page, the Tomcat server is requested to respond to the request.
2) Apache is simple, fast, and stable, and can be used as a proxy server. Originally, it was used only for small or experimental Internet networks, and was gradually expanded to various Unix systems, especially for Linux. Apache has multiple products that support SSL technology and multiple virtual hosts. Apache is a process-based structure. Processes consume more system expenses than threads and are not suitable for multi-processor environments. Therefore, when an Apache Web site is expanded, it is usually to add servers or expand cluster nodes, rather than adding processors. The success of Apache mainly lies in its open source code, an open development team, and support for cross-platform applications (which can run on almost all UNIX, windows, and Linux platforms) and its portability.
Apache is installed as the default configuration in almost all Linux releases. Suse7.1 or even pre-installed Apache with various advanced module options, such as php3, mod_perl, and LDAP. Users will be surprised to find that a powerful web server is available after the system is successfully installed. Although installing Apache is not very simple, it is worthwhile to download the source code package and compile the new Apache if Apache with new features or security patches is released.
Apache not only has a large user base, but also has a wide range of Configuration documentation. Apache provides server-side support for script technology, such as Perl and PHP. Apache can use Apache JServ to support Java Servlets and JSP. Many modules of Apache implement security protection: for example, mod_auth provides proper protection for data on the server, while the SSL module is used to protect the communication security between the server and the client.
Next we will introduce the Tomcat server software. Tomcat is a jspserver developed by Sun and Apache. It supports versions such as servlet2.2 and jsp1.1. I suggest you use tomcat, and Tomcat will replace jserv in the future and become the main servlet & jspengine of Apache. Tomcat is designed to run on an independent server. Unlike jserv, which is attached to Apache, Tomcat can be used in servlet rather than httpservlet. Tomcat is a Java program, so it can be used as long as JDK is available. You do not need to consider the operating system platform.


The Tomcat server expanded as a web server has some problems to address:
  

Reference when processing static pages, Tomcat is not as fast as Apache. Tomcat is not configurable Like Apache. Tomcat is not as strong as Apache.


For the above reasons, a real website uses an Apache server as the Web server to provide services for static page requests of the website, and Tomcat server as a Servlet/jsp plug-in, displays the dynamic page of the website.
The structure like Apache + Tomcat has more special advantages, mainly reflected in better scalability and security. The main feature of this type of site is that every page may be dynamically generated, but the main part of the data is static (for example, all kinds of images GIF, JPG, PNG, streaming Media). This structure has the advantages of both scalability and security.

Summary:
Apache + Tomcat is an enterprise-level application.
1. apache is mainly used to parse static text, such as HTML and tomcat. However, Apache can greatly improve efficiency and better display Apache's high efficiency for enterprise-level applications with large concurrency;
2. tomcat is used to parse JSP and Servlet. All customer requests are first sent to Apache. If the request is static text, it is parsed by Apache and the results are returned to the client. If the request is dynamic, for example, JSP, Apache will hand over the parsing work to Tomcat for parsing by Tomcat (this requires the actual integration of the two). After Tomcat Parsing is complete, the result is still returned to the client through Apache, in this way, the division of labor and cooperation can be achieved to achieve load balancing and improve system performance!

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.