参考:
http://dawanghai.iteye.com/blog/663927
What is the difference between an application server and a Web server?
Taking a big step back, a Web server serves pages for viewing in a Web browser, while an application server provides methods that client applications can call. A little more precisely, you can say that:
A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols.
Let's examine each in more detail.
The Web server
A Web server handles the HTTP protocol. When the Web server receives an HTTP request, it responds with an HTTP response, such as sending back an HTML page. To process a request, a Web server may respond with a static HTML page or image, send a redirect, or delegate the dynamic response generation to some other program such as CGI scripts, JSPs (JavaServer Pages), servlets, ASPs (Active Server Pages), server-side JavaScripts, or some other server-side technology. Whatever their purpose, such server-side programs generate a response, most often in HTML, for viewing in a Web browser.
Understand that a Web server's delegation model is fairly simple. When a request comes into the Web server, the Web server simply passes the request to the program best able to handle it. The Web server doesn't provide any functionality beyond simply providing an environment in which the server-side program can execute and pass back the generated responses. The server-side program usually provides for itself such functions as transaction processing, database connectivity, and messaging.
While a Web server may not itself support transactions or database connection pooling, it may employ various strategies for fault tolerance and scalability such as load balancing, caching, and clustering—features oftentimes erroneously assigned as features reserved only for application servers.
The application server
As for the application server, according to our definition, an application server exposes business logic to client applications through various protocols, possibly including HTTP. While a Web server mainly deals with sending HTML for display in a Web browser, an application server provides access to business logic for use by client application programs. The application program can use this logic just as it would call a method on an object (or a function in the procedural world).
Such application server clients can include GUIs (graphical user interface) running on a PC, a Web server, or even other application servers. The information traveling back and forth between an application server and its client is not restricted to simple display markup. Instead, the information is program logic. Since the logic takes the form of data and method calls and not static HTML, the client can employ the exposed business logic however it wants.
In most cases, the server exposes this business logic through a component API, such as the EJB (Enterprise JavaBean) component model found on J2EE (Java 2 Platform, Enterprise Edition) application servers. Moreover, the application server manages its own resources. Such gate-keeping duties include security, transaction processing, resource pooling, and messaging. Like a Web server, an application server may also employ various scalability and fault-tolerance techniques.
How do Web and application servers fit into the enterprise?
An example
As an example, consider an online store that provides real-time pricing and availability information. Most likely, the site will provide a form with which you can choose a product. When you submit your query, the site performs a lookup and returns the results embedded within an HTML page. The site may implement this functionality in numerous ways. I'll show you one scenario that doesn't use an application server and another that does. Seeing how these scenarios differ will help you to see the application server's function.
Scenario 1: Web server without an application server
In the first scenario, a Web server alone provides the online store's functionality. The Web server takes your request, then passes it to a server-side program able to handle the request. The server-side program looks up the pricing information from a database or a flat file. Once retrieved, the server-side program uses the information to formulate the HTML response, then the Web server sends it back to your Web browser.
To summarize, a Web server simply processes HTTP requests by responding with HTML pages.
Scenario 2: Web server with an application server
Scenario 2 resembles Scenario 1 in that the Web server still delegates the response generation to a script. However, you can now put the business logic for the pricing lookup onto an application server. With that change, instead of the script knowing how to look up the data and formulate a response, the script can simply call the application server's lookup service. The script can then use the service's result when the script generates its HTML response.
In this scenario, the application server serves the business logic for looking up a product's pricing information. That functionality doesn't say anything about display or how the client must use the information. Instead, the client and application server send data back and forth. When a client calls the application server's lookup service, the service simply looks up the information and returns it to the client.
By separating the pricing logic from the HTML response-generating code, the pricing logic becomes far more reusable between applications. A second client, such as a cash register, could also call the same service as a clerk checks out a customer. In contrast, in Scenario 1 the pricing lookup service is not reusable because the information is embedded within the HTML page. To summarize, in Scenario 2's model, the Web server handles HTTP requests by replying with an HTML page while the application server serves application logic by processing pricing and availability requests.
Caveats
Recently, XML Web services have blurred the line between application servers and Web servers. By passing an XML payload to a Web server, the Web server can now process the data and respond much as application servers have in the past.
Additionally, most application servers also contain a Web server, meaning you can consider a Web server a subset of an application server. While application servers contain Web server functionality, developers rarely deploy application servers in that capacity. Instead, when needed, they often deploy standalone Web servers in tandem with application servers. Such a separation of functionality aids performance (simple Web requests won't impact application server performance), deployment configuration (dedicated Web servers, clustering, and so on), and allows for best-of-breed product selection.
Tomcat Tomcat严格意义上并不是一个真正的App Server,它只是一个可以支持运行Serlvet/JSP的 Web容器,不过Tomcat也扩展了一些App Server的功能,如JNDI,数据库连接池,用户事务 处理等等。
web服务器:Tomcat
应用服务器:IBM Websphere,BEA WebLogic,RedHat JBoss
分享到:
相关推荐
Web 服务器与应用服务器配置(Apache+Tomcat&PHP) 本文将详细介绍 Web 服务器与应用服务器配置,包括 Apache、Tomcat 和 PHP 的安装、配置和集成。这些技术是 Web 开发和学习的基础,掌握它们可以帮助开发者更好地...
**WEB服务器与应用服务器的区别** **一、WEB服务器** WEB服务器,其主要职责是处理HTML文件,即存储和提供网页的服务器。常见的WEB服务器软件包括IIS和Apache。它们主要负责与客户端(通常是Web浏览器)进行交互,...
IIS、Apache、Tomcat、Weblogic、WebSphere 都是不同的服务器, Apache 是纯粹的 Web 服务器,Tomcat 是一个 Servlet 和 JSP 容器,可以作为轻量级应用服务器,IIS 是一个兼具应用服务器功能的 Web 服务器,Weblogic...
### Web服务器与应用服务器知识点详解 #### 一、Web服务器 **定义与功能:** Web服务器是一种用于处理HTTP(超文本传输协议)请求,并向客户端(通常是浏览器)发送响应的服务器。其主要职责是处理静态内容,如...
Web服务器和应用服务器是两种不同层次的服务器,它们在软件开发中扮演着至关重要的角色,尤其是在构建复杂的Web应用程序时。本文将深入探讨这两种服务器的区别、联系以及常见的服务器实例。 首先,Web服务器,如IIS...
Web服务器和应用程序服务器是两种不同的服务类型,它们在互联网应用中扮演着各自的关键角色。本文将详细解释这两者的概念、功能以及它们之间的差异。 首先,Web服务器主要负责处理HTTP协议,它的核心任务是接收来自...
Web服务器与Web应用服务器的区别,详细讲解WebServer与WebApplicationServer区别
《WEB服务器应用指南》这份资料深入浅出地介绍了WEB服务器的构建、配置和优化,旨在帮助用户更好地理解和操作WEB服务器。下面将详细阐述其中的知识点。 一、WEB服务器基础 WEB服务器是互联网上的一个重要组成部分,...
"简单Web服务器设计与实现" 本文主要介绍了简单Web服务器的设计与实现,涵盖了WWW的工作原理、HTTP协议、Java语言、Web服务器的设计与实现等方面的知识点。 WWW的工作原理基于客户机/服务器计算模型,由Web浏览器...
### WEB服务器和应用服务器之间的区别 #### 一、概述 在现代互联网技术中,服务器扮演着至关重要的角色,尤其在企业级应用开发中,WEB服务器和应用服务器的区别尤为重要。这两种服务器各自承担着不同的职责,相互...
在IT领域,Web服务器是提供HTTP(超文本传输协议)服务的应用程序,允许用户通过互联网访问网站和网页。本文将详细介绍如何简单搭建一个WEB服务器,包括基础概念、所需工具及步骤,旨在帮助初学者快速入门。 一、...
【标题】"小巧WEB服务器应用程序"是一个专为桌面应用程序与WEB应用程序集成设计的轻量级服务器软件。这种服务器软件的主要目标是提供一个简单且高效的方式来让用户的WEB应用程序在本地环境中快速部署和运行。 ...
Web服务器与应用服务器之间的联系在于,两者往往协同工作,Web服务器处理静态内容,应用服务器则处理动态内容和业务逻辑。例如,Apache可以作为一个HTTP服务器,而Tomcat作为应用服务器,两者通过集成实现动态和静态...
总结来说,Web服务器专注于提供静态内容,HTTP服务器与Web服务器概念接近。应用程序服务器则负责处理动态内容和业务逻辑,通常包含更丰富的功能。在实际应用中,这些服务器可以单独使用,也可以相互协作,以满足不同...
【基于QT的轻量级web服务器】是一种在Linux环境下运行的、使用QT库开发的简易Web服务器。QT是一个跨平台的C++图形用户界面应用程序开发框架,它为开发者提供了丰富的API,使得构建桌面和移动应用变得更为便捷。在这...
这款Web服务器源码可能是为了教学、学习或实践目的而创建的,使用者可以通过分析和修改源代码来理解Web服务器的工作原理,以及易语言在构建网络服务方面的应用。 【描述】"易语言简易WEB服务器源码.rar" 描述中的"....
"应用服务器的搭建--创建Web服务器" 本实验报告旨在详细介绍应用服务器的搭建过程,特别是使用 IIS 组件配置 Web 服务器的详细步骤,并进行测试连接。 Experiment Purpose 1. 了解 Windows 服务器的网络组件,...