当前位置: > Linux服务器 > Tomcat >

Tomcat vs. Apache: Why One Over the Other?

时间:2019-11-01 07:38来源:learncomputer.com 作者:IT网
Tomcat vs Apache

When determining which type of web server to use, the differences and technical details can be daunting. It can be a difficult task to compare web servers and make the decision on which is best for you and your project. Since Apache is currently the most popular web server, this article will discuss the differences between the Apache Web Server and Apache Tomcat, which are very different and fulfill different needs.

The Apache Web Server, often just called “Apache” or “httpd”, was developed in 1995 by Robert McCool and continuous development as well as maintenance is provided by the Apache Software Foundation. Known as the most popular web server, it has surpassed over 100 million websites and serves 63% of all websites as well as 66% of the million busiest. This is a huge accomplishment for a server that is an entirely an open-source project but the fact that it is free is one of the biggest reason for such a huge following.

The Apache Web Server is a C language implementation of an HTTP web server and can run a variety of features and modules to extend the core functionality.

Here are some points in favor of the Apache Web Server over Tomcat:

  • It is faster than Tomcat when serving static pages
  • Apache has more configuration options than Tomcat
  • Supports CGI scripts, Server API modules, Perl, PHP, etc…

The big downside for Apache is the lack of functionality for Java Servlets or JavaServer Pages, which cannot be run with Apache’s web server. Tomcat was created to address this problem.

Apache Tomcat, otherwise known as “Tomcat” is an open-source web server that started as a servlet reference in 1999 and is developed and maintained by the Apache Software Foundation. It is a Java implementation that runs Java Servlets and JavaServer Pages, known as JSPs, as specified from Oracle. Often used together, Tomcat can be a valuable addition to your Apache Web Server installation; however, Tomcat can also stand on its own as a web server without Apache. There are different installation methods and way that Tomcat can run to either supplement your Apache Web Server or run on its own:

  • When running a Java-based web server, Tomcat can be used in “standalone” mode, which allows it to be used as a component to the web server. Tomcat will become a servlet container in your JSP environment that manages and invokes servlets on behalf of users. However, most web servers are not Java-based, which means you have to choose a different installation setup.
  • When running Tomcat with Apache, you can run it “in-process” as an add-on servlet container, much like it would run in standalone mode but in conjunction with Apache. It runs as a combination of web server plugin and Java container implementation that runs in a JVM outside the web server. This method is great for multi-threaded, single-process servers and provides good performance at the price of scalability.
  • The last installation method is “out-of-process”, which allows Tomcat to run as a combination of a web server plugin and Java container implementation that runs outside of the web server. Communication between the Java container JVM and the web server plugin happens using an IPC mechanism such as TCP/IP sockets. When a request comes in to the web server that requires a Servlet, the plugin takes over the request and passes it to the Java container. You get the opposite benefits of running “in-process” since the response time is not as optimal but the “out-of-process” method performs better in scalability and stability.

Here are some points in favor of Tomcat over Apache httpd Web Server:

  • Provides the Java Servlet and JSP support for dynamically served pages
  • Works as a light-weight testing server
  • Can be run in different modes to promote better performance

If you are interested in learning beyond the overview of each server, we provide both Apache training and Tomcat training courses as part of LearnComputer’s regular curriculum.

For users that need to run Java Servlets or JavaServer pages, Tomcat is definitely the best implementation for you. However, if you are running a lot of static pages or need other dynamic techniques, you may want to stick with the Apache Web Server and run Tomcat either in- or out-of-process to get the Java support that you need. Either way, you will know that you are running one of the best web servers available without having to pay unnecessary cost for it.

Source:http://www.learncomputer.com/tomcat-vs-apache/

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容