What is the difference between web servers and application servers?

zhaozj2021-02-16  51

(Translator Note: The following QA is on the JavaWorld website. It is very meticulous, it is a good article. When translates it, there are many terms that may translate not very standard, so try to retain the original word in English. Due to time rush There are many mistakes, please reader friends don't point out. Original website: http://www.javaworld.com/javaqaqa/2002-08/01-qa-0823-appvswebserver.html)

Q: What is the application server, what is a web server, what is the difference? A: Popular, the web server transfer (SERVES) page enables the browser to browse, however the application server is provided by the client application to call (Methods). Exactly, you can say: The web server dealt with the HTTP request, but the application server is available to the application (Business logic) for applications through many protocols. Let us come to fine track:

Web Server The web server can resolve (Handles) HTTP protocol. When the web server receives an HTTP request, an HTTP response will be returned, for example, a HTML page is sent back. To handle a request, the web server can respond to a static page or image, performing a redirect, or delegate Dynamic Response, for some other programs such as CGI, such as CGI Script, JSP (JavaServer Pages) script, servlets, ASP (Active Server Pages) script, server-side JavaScript, or some other server-side technology. Regardless of their (translator Note: Script), these server-sides typically generate an HTML response (response) to allow the browser to be browsed.

You know, the Delegation Model of the web server is very simple. When a request is sent to the web server, it only passes the request (Request) to a program that can process the request (Translator Note: Server-side script). The web server only provides an environment that can execute the server-side program and the response (program generated) response (the program is generated), without exceeding the functional range. Server-Side program typically has functions such as transaction processing, database connection (MESSAGING) and other functions.

Although the web server does not support transaction processing or database connection pools, it can configure (EMPLOY), FAULT TOLERANCE and Scalability, such as load balancing, buffer Caching. Clustering-features is often mistakenly considered just the application server proprietary features.

The Application Server, according to our definition, as an application server, through a variety of protocols, can include HTTP, exposing business logic to (Expose) client applications. The web server is primarily handled to send HTML to your browser for browsing, while the application server provides access to business logic for client applications. Applications use this business logic like a method you call objects (or a function in the process language). The client of the application server (including the graphical user interface (GUI) may run on a PC, a web server or even other application servers. Information on TRAVELINGs between the application server and its client is not limited to a simple display mark. Instead, this information is program logic. It is because this logic achieves the form of data and method calls (Calls) instead of static HTML, so the client can use this exposed business logic as desirable.

In most cases, the application server is exposing commercial logic (to client applications), such as J2EE (Java 2 Platform, Enterprise Edition) applying, for example, Java 2 Platform, Enterprise Edition, based on Component. The EJB (Enterprise Javabean) component model of the program server. In addition, the application server can manage your own resources, such as the Gate-Keeping Duties, including security, transaction processing, resource pooling, and messages. Like a web server, the application server configures a variable tolerance technology.

An example, for example, an online store (website) provides real-time pricing and Availability information. This site (site) is likely to provide a form (Form) to let you choose the product. When you submit a query (query), the website will find (lookup) and return the results in the HTML page. Website can have many ways to implement this function. I want to introduce a scenario that does not use the application server and a scenario using the application server. Observe the differences in these two consequences will help you understand the functionality of the application server.

Scenario 1: Web server without application servers

In this scenario, a web server is independently providing the function of online stores. The web server gets your request and then sent to the server-side to process the request (Request). This program comes from a database or text file (Flat File, Translator Note: Flat file means finding pricing information in a non-binary file without special format, such as Properties and XML files, etc.). Once found, the Server-Side program represents the result information into the form of a (formally) HTML, and finally the web server will send it to your web browser.

In short, the web server is just a simple to process HTTP requests (Request) by responding to the response HTML page.

Scenario 2: Web server with application server

Scenario 2 and scenarios are the same as the web server or delegates, delegates (Translator Note: Server-Side). However, you can put the business logic of the lookup pricing to the application server. Due to this change, this script is just a simply invoke the application server's lookup service, not how to find data and represent a response. At this time, the return result of the service can be used when the scripter generates an HTML response (Response). In this scenario, the application server provides commercial logic for querying the pricing information of the product. (FunctionAlity) does not point out the details about how to use this information, the opposite client and the application server are only sent back and forth. This service is just a simple lookup and returns the result to the client when there is a LOOKUP service.

Separate from the response generation (Response-Generating) HTML code, the reusability of the pricing (lookup) logic is stronger in the application. Other clients, such as a cash register, can also call the same service (service) to check up as a clerk. Instead, the pricing lookup service in the scenario 1 is unbelred because the information is embedded in the HTML page.

In summary, in the model 2 model, the WEB server processes the HTTP request by responding to the HTML page, and the application server provides application logic by handling the pricing and validity request (availability) request.

WARNING (Caveats) Now, XML Web Services has confused the application server and web server's boundaries. By transmitting an XML payload to the server, the Web server can now handle data and response (response) capabilities, as much as the previous application server.

In addition, most application servers also contain web servers, which means that the web server can be regarded as a subset of the application server. Although the application server contains the functionality of the web server, developers rarely deploy the application server into this function (Translator Note: This feature refers to both the function of the existing application server. The function of the web server). Conversely, if necessary, they usually configure the web server, and the application server is one after another. Separation of this function helps improve performance (simple web request, does not affect the application server), separate configuration (special web server, clustering), etc.), and give the best product There is room for selection.

转载请注明原文地址:https://www.9cbs.com/read-25973.html

New Post(0)