Tag Archives: Apache vs Nginx vs Tomcat vs JBoss vs Jetty

Apache vs Nginx vs Tomcat vs JBoss vs Jetty

Reference

[1] https://blog.csdn.net/allenlinrui/article/details/6675998

Nginx

lightweight, using C to write, the same web services, will occupy less memory and resources

anti concurrency, nginx takes epoll and kqueue as the development model, processing requests is asynchronous and non blocking, the load capacity is much higher than that of Apache, and Apache is blocking. Under high concurrency, nginx can maintain low resource consumption and high performance, while Apache is prone to process surge and denial of service when PHP processing is slow or front-end pressure is high

The static processing performance of nginx is three times higher than that of Apache

nginx is highly modular in design and relatively simple in module writing

nginx configuration is simple, regular configuration makes a lot of things simple, and after changing the configuration, you can use – t to test whether there is a problem with the configuration. Apache configuration is complex. When you restart, you find that the configuration is wrong, and it will crash

As a load balancing server, nginx supports 7-tier load balancing

nginx itself is a reverse proxy server, and can be used as a very good mail proxy server

it is particularly easy to start, and it can almost run 7 * 24 without interruption. Even if it runs for several months, it does not need to restart, and it can also upgrade the software version without interruption of service

the community is active and various high-performance modules are produced rapidly

Apache

rewriting of Apache is more powerful than nginx. When rewriting is frequent, use Apache

with the development of Apache, there are so many modules that you can find all you think of

Apache is more mature with fewer bugs, and nginx has more bugs

Apache super stable

Apache’s support for PHP is relatively simple, and nginx needs to be used with other back ends

Apache has advantages in processing dynamic requests. Nginx is a chicken in this aspect. Generally, dynamic requests need to be done by Apache, and nginx is suitable for static and reverse

Apache is still the mainstream, with rich features, mature technology and development community

Apache vs Nginx

The core difference between the two is that Apache is a synchronous multi process model, one connection corresponds to one process, while nginx is asynchronous, and multiple connections (10000 levels) can correspond to one process

Generally speaking, web services with high performance are needed, using nginx. If you don’t need performance and just want stability, and think more about Apache, the latter’s various functional modules are better than the former. For example, SSL’s modules are better than the former, with more configurable items. Epoll (kqueue on FreeBSD) network IO model is the fundamental reason for the high processing performance of nginx, but it is not always epoll’s victory. If there are only a few files that provide static services, Apache’s select model may have higher performance than epoll. Of course, this is only a hypothesis based on the principle of network IO model, and the real application still needs to be measured

A more general solution is that the front-end nginx is anti concurrency, and the back-end Apache cluster will work better together

Tomcat

Tomcat is a JSP server (servlet container) developed by Java, which conforms to Java EE’s servlet specification. It is an extension of Apache

Features: Free Java application server

1. It is mainly used to parse JSP/servlet, focusing on servlet engine

2. It supports static pages, but its efficiency is not as high as Apache; Support servlet and JSP requests

3. Tomcat also has a built-in HTTP server to support static content, which can be integrated with Apache through Tomcat’s configuration management tool

Jboss

Application server, the J2EE application server running EJB, follows the J2EE specification and can provide more platform support and more integration functions, such as database connection,
JCA, etc; Its support for servlets is realized by integrating other servlet containers, such as Tomcat and jetty

2. JBoss needs less memory and hard disk space

3. The installation is very simple. First decompress the JBoss package file, and then configure some environment variables

4. JBoss can be “hot deployed”, deploying bean is just a simple copy of bean’s jar file to the deployment path. If not, load it; If it has been loaded, unload it, and then load the new one

5. JBoss and web server run in the same Java virtual machine. Servlet calls EJB without passing through the network, which greatly improves the running efficiency and security performance

6. Users can implement j2ee-ear directly instead of implementing ejb-jar and web-war separately, which is very convenient

Apache vs Tomcat

one:
Apache supports static pages, Tomcat supports dynamic pages, such as servlets, etc.
when Apache + Tomcat is generally used, Apache is only used as a forwarding, and Tomcat handles JSPS<
apche can support phpcpiperl, but to use Java, you need Tomcat to support in the Apache background and forward Java requests from Apache to Tomcat for processing
Apache is a web server and Tomcat is an application (Java) server. It is just a servlet container. It can be considered as an extension of Apache, but it can run independently of Apache

These two can be compared in the following aspects:
A. both are developed by Apache
B. both have the function of HTTP service
C. both are free

Differences:

Apache is specially used to provide HTTP services, and related configuration (such as virtual host, URL forwarding, etc.) Tomcat is a JSP server developed by Apache organization in accordance with Java EE JSP and servlet standards

2:
Apache is a web server environment program, which can be used as a web server when it is enabled, but it only supports static web pages such as (ASP, PHP, CGI, JSP) and other dynamic web pages
if you want to run JSP in Apache, you need an interpreter to execute JSP Web pages, and the JSP interpreter is Tomcat. Why JDK?Because JSP needs to connect to the database, it needs JDK to provide the drive to connect to the database, so the web server platform to run JSP needs Apache + Tomcat + JDK A. if the client requests a static page, only the Apache server needs to respond to the request
B. if the client requests a dynamic page, the Tomcat server responds to the request
C. Because JSP is interpreted by server, the integration can reduce the service cost of Tomcat

Three:
Apache: focuses on HTTP server
Tomcat: focuses on 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 container. It can be considered as an extension of Apache, but it can run independently of Apache

PS: as for why Tomcat and Apache should be integrated, the main function of Tomcat is to provide servlet/JSP container. Although it can also be used as an independent Java Web server, Tomcat is inferior to other professional HTTP servers in processing static resources (such as HTML files or image files) and providing web server management functions, Such as IIS and Apache server. Therefore, in practical applications, Tomcat is often integrated with other HTTP servers. For HTTP servers that do not support servlet/JSP, you can run servlet/JSP components through Tomcat server. When Tomcat is integrated with other HTTP servers, the working mode of Tomcat server is usually an out of process servlet container. Tomcat server communicates with other HTTP servers through special plug-ins

Apache + JBoss/Tomcat

Apache and JBoss or Tomcat are usually used for load balancing. JBoss can integrate Tomcat or jetty

To deploy and run a servlet, aweb containermust be used. A web container (also known as a servlet container) is essentially the component of a web server that interacts with the servlets. The web container is responsible for managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL requester has the correct access rights.

Tomcat focuses on web container or servlet container, Apache is web server, responsible for the management and interaction with web container/servlet container

JBoss vs Tomcat

Run by RedHat JBoss is a full-stack support for JavaEE and it is a certified Java EE container. This includes Tomcat as web container internally.

Tomcat is just a servlet container, i.e. it implements only the servlets and JSP specification. Glassfish and JBoss are full Java EE servers (including stuff like EJB, JMS, …)