Differences between Apache, Tomcat, JBOSS, and Nginx,

Source: Internet
Author: User
Tags http authentication url forwarding

Differences between Apache/Tomcat/JBOSS/Nginx (conversion ),

Let's talk about the differences between Apache and Tomcat:

Apache is the world's No. 1 Web server software. It can run on almost all widely used computer platforms. Because of its wide use of cross-platform and security, it is one of the most popular Web server software.
In the Apache Foundation, ApacheServer will always be given the greatest support. After all, the eldest son is the most favored, while Apache's open-source server software Tomcat is also worth noting. After all, Tomcat is an open-source free product, the user will give the maximum support. However, when using Apache, Tomcat, and other servers, you still don't know the relationship between them. Apache is always confused when using Tomcat, in the end, who is the primary user and who is the secondary user, so I found some materials on the Internet and summarized them.
Resolution 1:
Apache supports static pages. Tomcat supports dynamic pages, such as servlets,
If Apache + Tomcat is used, Apache is only used as a forward object, and JSP processing is handled by Tomcat.
Apche supports PHPcgiperl, but to use Java, you need to support Tomcat in the Apache background to forward Java requests to Tomcat for processing.
Apache is a Web server, and Tomcat is an application (Java) server. It is just a Servlet (JSP is also translated into Servlet) container. It can be considered as an extension of Apache, but it can run independently of Apache.

The two have the following points for comparison:
◆ Both are developed by Apache.
◆ Both have HTTP service functions
◆ Both are free of charge
Differences:
Apache provides HTTP services and related configurations (such as virtual hosts and URL forwarding)
Tomcat is a JSP server developed by Apache in compliance with Java ee jsp and Servlet standards.
Runtime r = Runtime. getRuntime (); Process p = null; try {p=r.exe c ("notepad");} catch (Exceptionex) {System. out. println ("fffff ");}

Resolution 2:
Apache is a Web server environment program that can be used as a Web server. However, Apache does not support dynamic webpages such as ASP, PHP, CGI, and JSP.
If you want to run JSP in the Apache environment, you need an interpreter to execute the JSP webpage. This 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.
The benefits of integration are:
◆ If the client requests a static page, the Apache server only needs to respond to the request.
◆ If the client requests a dynamic page, the Tomcat server responds to the request.
◆ Because JSP is interpreted on the server side, integration can reduce Tomcat service overhead.
C is a structured language, as Tan said: it focuses on algorithms and data structures. The primary consideration of C program design is how to use a process to perform operations on input (or environmental conditions) to obtain output (or implement process (transaction) control ), for C ++, the primary consideration is how to construct an object model so that the model can fit the corresponding problem domain, in this way, you can obtain the output or implement process (transaction) control by obtaining the object state information.
Resolution 3:
Apache: focuses on HTTPServer
Tomcat: focuses on the Servlet engine. If it runs in Standalone mode, it is functionally equivalent to Apache and supports JSP, but it is not ideal for static web pages;
Apache is a Web server, and Tomcat is an application (Java) server. It is just a Servlet (JSP is also translated into Servlet) container. It can be considered as an extension of Apache, but it can run independently of Apache.

PS: Why is Tomcat and Apache integrated?

The main function of Tomcat is to provide Servlet/JSP containers, although it can also be used as an independent Java Web Server

Server, but the processing speed of static resources (such as HTML files or image files), as well as the Web server provided

In terms of management functions, Tomcat is inferior to other professional HTTP servers, such as IIS and Apache servers.

Therefore, Tomcat is often integrated with other HTTP servers in practical applications. For Servlet/JSP not supported

You can use the Tomcat server to run Servlet/JSP components.

When Tomcat is integrated with other HTTP servers, the working mode of the Tomcat server is usually the Servlet

Containers, Tomcat servers, and other HTTP servers communicate with each other through specialized plug-ins.

(1.1) Independent Servlet Container
In this mode, Tomcat can be used as an independent Java Web server, and Servlet containers exist as part of the Web server. The independent Servlet container is the default Tomcat mode.

23.2) Servlet container in process

Servlet containers are divided into Web Server plug-ins and Java containers. The Web server plug-in opens a Java Virtual Machine in the address space of other Web servers. The Java container runs Servlet in this JVM. If a client sends a request to call Servlet, the plug-in obtains control of the request and passes it to the Java container. The in-process Servlet container is very suitable for single-process and multi-process servers, providing high running speed and scalability.

4.5.3) Servlet containers outside the process

Servlet containers are divided into Web Server plug-ins and java containers. The Web server plug-in opens a JVM in the external address space of other Web servers. The java container runs Servlet in this JVM. If a client sends a request to call Servlet, the plug-in obtains control of the request and passes it to the java container. The response speed of the non-process Servlet container to the customer request is not as fast as that of the In-process container, but the non-process container has better scalability and stability.

Tomcat can be used as an independent Servlet container or integrated with other Web servers as a Servlet container in the process or as a Servlet container outside the process. Differences between Tomcat and Jetty:

Tomcat server is a free open-source Web Application Server (mainly used to parse servlet/JSP and provide http Services). It is advanced in technology, stable in performance, and free of charge, therefore, it is favored by Java enthusiasts and recognized by some software developers. It consumes a small amount of system resources during running and has good scalability. It also supports common functions for development and application systems, such as load balancing and mail service. As a small lightweight application server, Tomcat is widely used in small and medium-sized systems and concurrent access to a large number of users. It has become a popular Web application server.
Jetty uses the best open-source Java Web engine in the industry. Jetty has the largest downloads and the largest number of users in the Java Community, and uses the most complete Tomcat kernel as its Servlet container engine, review and optimization. Pure Tomcat has limited performance and lacks performance in many places, such as active connection support, static content, large files, and HTTPS. In addition to performance problems, Tomcat is also a restricted integration platform that can only run Java applications. When using Tomcat, enterprises often need to deploy Apache WebServer at the same time for integration. This configuration is cumbersome and does not guarantee performance superiority.
Jetty solves many Tomcat shortcomings by using a hybrid model of APR and Tomcat local technology. The hybrid technology model provides the best thread and event processing from the latest operating system technology. As a result, Jetty achieves scalability, and Performance Parameters match or even surpass the local Apache HTTP Server or IIS. For example, Jetty can provide database connection pool services. It not only supports Java technologies such as JSP, but also supports integration of other Web technologies, such as PHP and. NET.
Standardization is the best way to reduce technical dependency risks and protect investment. Jerry took the lead in supporting the full range of JEE Web standards, which fundamentally ensured the "one-time development, running everywhere" feature of the application, so that the application finished products can be easily migrated between Jetty and other Java Web servers.

Similarities:

All are web containers, which have the same functions and are used as the integrated web containers of jboss (jboss of tomcat version and jboss of jetty version, that is, Versions later than 4.0)

Differences:

The implementation mechanism is slightly different, and Jetty has better performance.

Differences between Nginx/Apache/lighttpd:

1. lighttpd

Lighttpd features low memory overhead, low cpu usage, good performance, and rich modules. Lighttpd is one of the many OpenSource lightweight web servers. Supports important functions such as FastCGI, CGI, Auth, output compression (outputcompress), URL rewriting, and Alias.

Lighttpd uses fastcgi to run php, which uses a small number of PHP processes to respond to a large amount of concurrency.

Fastcgi has the following advantages:

· In terms of stability, fastcgi uses an independent process pool to run cgi. When a single process dies, the system can easily discard it and re-allocate a new process to run the logic.

· In terms of security, fastcgi is completely independent from the host server, and fastcgi will not crash the server even if it is down,

· In terms of performance, fastcgi separates the processing of dynamic logic from the server, leaving heavy-load IO processing to the host server, so that the host server can work with IO with one mind, for a common dynamic web page, logical processing may only be a small part. Static IO processing, such as a large number of images, does not require the participation of Logic Programs (note 1)

· In terms of scalability, fastcgi is a neutral technical standard that fully supports processing programs written in any language (php, java, Python ...)

2. apache

Apache is the world's top web server. According to a survey conducted by netcraft (www. netsraft. co. uk), more than 50% of the world's web servers are using apache.

In April 1995, the earliest apache version 0.6.2 was released by apache group. apache group is a non-profit organization that operates completely over the internet. It determines what content should be included in the standard release of apache web servers. allow anyone to modify hidden errors, provide new features and port them to the new platform, and perform other work. when the new Code is submitted to the apache group, the group reviews the specific content of the Code for testing. If satisfied, the code will be integrated into the main apache release.

Apache features:

1) It can run on almost all computer platforms.

2) supports the latest http/1.1 protocol

3) simple and powerful file-based configuration (httpd. conf ).

4) General Gateway Interface (cgi) supported)

5) supports virtual hosts.

6) supports http authentication.

7) Integrate perl.

8) Integrated Proxy Server

9) you can use a web browser to monitor the server status and customize logs.

10) the server can contain commands (ssi ).

11) supports Secure socket Layer (ssl ).

12) tracking the user session process.

13) fastcgi support

14) Support for java servlets

3. nginx

Nginx is a lightweight HTTP server compiled by Russians. It is pronounced as "engine X" and is a high-performance HTTP and reverse proxy server, it is also an IMAP/POP3/SMTP proxy server. nginx is developed by the Russian site Igor Sysoev, which has the second access volume in Russia.

Nginx is written in event-driven mode, so it has excellent performance and is also a very efficient reverse proxy and load balancing. It has the performance matching Lighttpd, and there is no Lighttpd Memory leakage problem, and the mod_proxy of Lighttpd also has some problems and has not been updated for a long time. However, Nginx does not support running in cgi Mode because it can reduce some program vulnerabilities. Therefore, you must use FastCGI to execute PHP programs.

As an HTTP server, nginx has the following basic features:

Process static files, index files, and automatic indexes; enable file descriptor buffering.

Non-Cache reverse proxy acceleration, simple load balancing and fault tolerance.

FastCGI, simple load balancing and fault tolerance.

Modular structure. Including gzipping, byteranges, chunked responses, and SSI-filter. If FastCGI or another Proxy Server Processes multiple SSI in a single page, the processing can run in parallel without waiting for each other.

Nginx is designed for performance optimization. performance is the most important consideration, and efficiency is very important in implementation. It supports the kernel Poll model and can withstand the high load test. The report shows that it supports up to 50,000 concurrent connections.

Nginx has high stability. When other HTTP servers encounter access peaks or maliciously initiate slow connections, the server may also consume physical memory and exchange frequently. In this case, the server can only be restarted if the response is lost. For example, once apache has over 200 processes, the web response speed is obviously very slow. Nginx adopts the phased Resource Allocation technology, making it very low in CPU and memory usage. Nginx officially said that it maintains 10,000 idle connections, which only occupies MB of memory. Therefore, DOS-like attacks are basically useless for nginx. In terms of stability, nginx is better than lighthttpd.

Nginx supports hot deployment. It is easy to start and can run almost without interruption, even if it runs for several months, it does not need to be restarted. You can also upgrade the software version without interrupting the service.

Ii. Comparison of the three WEB servers:

Server

Apache

Nginx

Lighttpd

Proxy

Very good

Very good

Average

Rewriter

Good

Very good

Average

Fcgi

Not good

Good

Very good

Hot deployment

Not Supported

Supported

Not Supported

System pressure comparison

Very large

Very small

Relatively small

Stability

Good

Very good

Not good

Security

Good

Average

Average

Technical Support

Very good

Very few

Average

Static File Processing

Average

Very good

Good

Vhosts Virtual Host

Supported

Not Supported

Supported

Reverse Proxy

Average

Very good

Average

Session sticky

Supported

Not Supported

Not Supported

Note: in relatively large websites, the server cost saved is undoubtedly objective. Some small websites often have few servers. If we use traditional Web servers such as Apache, we seem to be able to continue. However, Apache is prone to overload when dealing with traffic spikes (such as crawlers or Digg effects). In this case, Nginx is the most suitable.

Recommended solution:

Apache backend server (mainly processing php and some functional requests such as Chinese URLs)

Nginx front-end server (using it to take advantage of a small amount of system resources to handle a large number of static page requests)

Lighttpd image server

In general, the improvement of nginx functions will make it the mainstream for web servers in the future.

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.