分享

Tomcat vs Apache

 集微笔记 2013-08-01

Tomcat vs Apache:您钟情于哪一款


本文探讨了 Apache 与 Apache Tomcat 之间的区别,帮助开发者选择更加适宜的Web服务器。

当你选择使用哪种Web服务器时,或许会因它们的差异性和技术细节等方面而困扰。如何区分Web服务器以及如何为你的项目挑选一款最佳的Web服务器,或许对你来说这是一个很难的决定。鉴于Apache目前最流行的一款Web服务器,本文将探讨Apache与Apache Tomcat两者之间的区别,以满足不同开发者的需求。

Apache Web服务器通常比称之为“Apache”或者“httpd”,1995年由Robert Mc Cool和他的团队开发,由Apache软件基金会提供支持与维护。Apache是目前最流行的Web应用服务器,拥有超过一亿的网站用户,占据互联网应用服务器63%的份额,以及全球最繁忙网站中有66%采用Apache的(比方说,维基百科网站服务器就是使用Apache)。


Apache

Apache获得了巨大的成就,它是一项完全开源的项目,其成功的大部分原因应归功于免费、稳定且性能卓越。Apache Web服务器是一个用C语言实现的HTTP Web服务器,支持各种特性和模块从而来扩展核心功能。

Apache的优越特性:

  • 访问静态页面比Tomcat要快
  • Apache有更多的配置选项
  • 支持CGI 脚本,Server API模块,Perl,PHP等

Apache最大的缺点是不支持Java Servlets或JavaServer Pages(JSP),无法在Apache Web服务器上运行,Tomcat由此而诞生。


Apache Tomcat

Apache Tomcat又被称之为“Tomcat”是一款开源的Web服务器,Jakarta项目中的一个核心项目,1999年被开发而成,支持Servlet和JSP,由Apache软件基金会提供支持与维护。

Tomcat是靠Java实现的,支持Java Servlets和JavaServer Pages(JSP),由Oracle公司指定的,因JSPs而著称。

Tomcat部分是Apache服务器的扩展,但它是独立运行的,所以当Apache Tomcat运行tomcat时,它实际上是作为一个与Apache独立的进程单独运行的。

提供Tomcat独立运行的几个不同的安装方法:

  1. 当运行在Java-based Web服务器时,Tomcat可以“独立”的模式使用,可当做Web服务器的组件。Tomcat将成为在你的JSP环境中管理和以用户名义调用servlets的一种servlets容器,大都数Web服务器不是Java-based系统,这也就意味着你必须选择一个不同的安装设置。
  2. 当Tomcat配置Apache服务器运行时,你可以以一个附加的Servlet容器运行“in-process”,就像是以独立的模式运行,但是必须与Apache相结合。它以Web服务器插件和Java容器实现的一种组合可运行在JVM之外的Web服务器。该方法非常适合多线程,单一进程服务器且提供良好的性能。
  3. “out-of-process”,允许Tomcat以Web服务器插件和Java容器实现的一种组合可在Web服务器之外运行。通过使用IPC机制如TCP/IP通信协议来传输Java容器JVM和Web服务器插件之间的数据。当有请求被发送至Web服务器时,通过Servlet请求插件接收request,并把request传输给Java容器。与运行“in-process”相反,当响应时间不在最佳状态时,用“out-of-process”方式能够帮助你更好地执行可扩展性和稳定性。

Tomcat的优越特性:

  • 提供Java Servlet和JSP支持动态服务器网页
  • 一个轻量级应用服务器
  • 可在不同的模式中运行,以提高其性能

如果你对它们都感兴趣的话,这里还提供了 Apache training 和 Tomcattraining 学习课程。

对于用户来说,如果你需要运行Java Servlets或者JavaServer pages(JSP),Tomcat绝对是你最好的选择;但如果你需要运行大量的静态页面(HTML)或者其他的一些动态技术(PHP、Perl),你可以选择Apache或者Tomcat的“in- process”或者“out-of-process”模式。 无论是哪一种,你都无须为为它支付任何费用,不是吗?

======================================================================================

Tomcat vs. Apache: Why One Over the Other


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.


Apache

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

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 trainingand 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.

翻译原文:  

Tomcat  vs Apache:您钟情于哪一款(中文)
Tomcat vs ApacheWhy One Over the Other(英文)

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多