应用服务器和Web服务器有什么区别?
应用服务器通常被设计和部署用于支持更长时间运行的、资源开销较大的进程。
Web服务器一般用于短暂而不需要过多资源的爆发式请求,主要是为了提供 web 流量服务。
一个 Web 服务器运行 HTTP 协议以提供 Web 页面。应用服务器可以(但并不总是)在 Web 服务器上运行以执行程序逻辑,然后 Web 服务器可传递其结果。这就是 Web 服务器/应用服务器场景的一个例子。
在微软世界中的一个很好的例子是 Internet Information Server / SharePoint Server 关系。IIS 是一个 Web 服务器;SharePoint 是一个应用服务器。SharePoint 位于 IIS “之上”,执行特定逻辑,并通过 IIS 提供结果。
在 Java 世界中,例如 Apache 和 Tomcat 就存在类似的情况。
最大的区别是Web服务器处理HTTP请求,而应用服务器将在任意数量的协议上执行业务逻辑。
实际上,Apache是一个Web服务器,而Tomcat是应用服务器。当有HTTP请求发送到Web服务器时,静态内容将由Web服务器发送回浏览器。如果需要执行逻辑,则将该请求发送到应用服务器。在处理完逻辑后,响应将发送回Web服务器并发送给客户端。
基础理解:
在客户端服务器架构中
服务器 :> 提供服务请求。
客户端 :> 消费服务。
Web服务器和应用程序服务器都是软件应用程序,它们作为服务器为其客户端提供服务。
它们的名称基于它们的使用地点。
Web server :> serve web content
:> Like Html components
:> Like Javascript components
:> Other web components like images,resource files
:> Supports mainly web protocols like http,https.
:> Supports web Request & Response formats.
Usage --
we require low processing rates, regular processing practices involves.
Eg: All flat servers generally available ready-made which serves only web based content.
Application server :> Serve application content/component data(Business data).
:> These are special kind which are custom written
designed/engineered for specific
purpose.some times fully unique in
their way and stands out of the crowd.
:> As these serves different types of data/response contents
:> So we can utilize these services for mobile client,web
clients,intranet clients.
:> Usually application servers are services offered on different
protocols.
:> Supports different Request& Response formats.
我们可以将它们视为4层/n层架构中的层次结构/分层。Usage --
we require multi point processing, specialized processing techniques involves like for AI.
Eg: Google maps servers, Google search servers,Google docs servers,Microsoft 365 servers,Microsoft computer vision servers for AI.
So they can provide
load balancing,
multiple security levels,
multiple active points,
even they can provide different request processing environments.
https://learn.microsoft.com/en-us/previous-versions/msp-n-p/ee658120(v%3dpandp.10)
CDI - Apache OpenWebBeans
EJB - Apache OpenEJB
JPA - Apache OpenJPA
JSF - Apache MyFaces
JSP - Apache Tomcat
JSTL - Apache Tomcat
JTA - Apache Geronimo Transaction
Servlet - Apache Tomcat
Javamail - Apache Geronimo JavaMail
Bean Validation - Apache BVal
现在已经没有必然的明确分界线。许多程序现在同时包含Web服务器(服务HTTP请求)和应用服务器(处理业务逻辑)的元素。