What is the difference between application server and web server?

前端 未结 27 1944
攒了一身酷
攒了一身酷 2020-11-22 17:03

What is the difference between application server and web server?

相关标签:
27条回答
  • 2020-11-22 17:33

    This is a detailed answer with some scenarios to clearly understand the difference and similarity, and how both can work in conjunction.

    Application Server is a term that sometimes is mixed with a web server. While a web server handles mainly HTTP protocols, the application server deals with several different protocols, including, but not limited, to HTTP.

    The Web server's main job is to display the site content and the application server is in charge of the logic, the interaction between the user and the displayed content. The application server is working in conjunction with the web server, where one displays and the other one interacts.

    The information traveling back and forth between the server and its client is not restricted to simple display markup, but to interaction between the two.

    In most cases, the server creates this interaction through a component API, such as J2EE (Java 2 Platform), EJB (Enterprise JavaBean) and other different application software models.

    enter image description here

    An example:

    The best way to understand the difference between the scenarios where an application server works with the web server versus a scenario where there isn't an application server is through an online store.

    Scenario 1: Web server without an application server

    you have an online store with only a web server and no application server. The site will provide a display where you can choose a product from. When you submit a query, the site performs a lookup and returns an HTML result back to its client. The web server sends your query directly to the database server (be patient, I will explain this one in our next nugget) and waits for a response. Once received, the web server formulates the response into an HTML file and sends it to your web browser. This back and forth communication between the server and database server happens every time a query is run.

    Scenario 2: Web server with an application server

    if the query you want to run has already been done previously and no data has changed since then, the server will generate the results without having to send the request to the database server. This allows a real-time query where a second client can access the same info and receive real time, reliable information without sending another duplicate query to the database server. The server basically acts as an intermediate between the database server and the web server. This allows the information pulled to be reusable while in the first scenario, since this info is embedded in a particular and "customized" HTML page, this is not a reusable process. A second client will have to request the info again and receive another HTML embedded page with the info requested -highly inefficient. Not to mention that this type of server is very flexible due to its ability to manage its own resources, including security, transaction processing, messaging and resource pooling.

    To support such a variety of complex tasks this server must have a built in redundancy, great processing power and high amount of RAM to handle all the data it's pulling in real time.

    0 讨论(0)
  • 2020-11-22 17:34

    As many have said before, web servers handle HTTP petitions, while application servers handle petitions for distributed components. So, maybe the easiest way to understand the difference is to compare the two products in regards to programming environment they offer.

    Web Server -> Programming Environment

    IIS : ASP (.NET)

    Tomcat : Servlet

    Jetty : Servlet

    Apache : Php, CGI

    Application Servers -> Programming Environment

    MTS : COM+

    WAS : EJB

    JBoss : EJB

    WebLogic Application Server : EJB

    The crucial difference is that application servers support some distributed component technology, providing features like remote invocation and distributed transactions, like EJB in Java world or COM+ on Microsoft platform. Http server often support some more simple programming environments, often scripting, like ASP (.NET) in case of Microsoft or Servlet--based, including JSP and many other in case of Java or PHP and CGI in case of Apache.

    Other capabilities like load-balancing, clustering, session-failover, connection pooling etc. that used to be in the realm of application servers, are becoming available on web servers as well directly or through some third party products.

    Finally, it is worth noting that the picture is further distorted with "lightweight containers" like Spring Framework, that often supplement the purpose of application servers in more simple manner and without the application server infrastructure. And since distribution aspect in applications is moving from distributed component towards service paradigm and SOA architecture, there is less and less space left for traditional application servers.

    0 讨论(0)
  • 2020-11-22 17:34

    Application server and web server both are used to host web application. Web Server is deal with web container on the other hand Application Server is deal with web container as well as EJB (Enterprise JavaBean) container or COM+ container for Microsoft dot Net.

    Web Server is designed to serve HTTP static Content like HTML, images etc. and for the dynamic content have plugins to support scripting languages like Perl, PHP, ASP, JSP etc and it is limited to HTTP protocol. Below servers can generate dynamic HTTP content.

    Web Server's Programming Environment:

    IIS : ASP (.NET)

    Apache Tomcat: Servlet

    Jetty: Servlet

    Apache: Php, CGI

    Application Server can do whatever Web Server is capable and listens using any protocol as well as App Server have components and features to support Application level services such as Connection Pooling, Object Pooling, Transaction Support, Messaging services etc.

    Application Server's Programming Environment:

    MTS: COM+

    WAS: EJB

    JBoss: EJB

    WebLogic Application Server: EJB

    0 讨论(0)
提交回复
热议问题