You are on page 1of 5

What is the difference between an appIication 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 CG 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
clusteringfeatures oftentimes erroneously assigned as features reserved only for application
servers.
The appIication 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 GUs (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. nstead, 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.
n most cases, the server exposes this business logic through a component AP, 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.

n exampIe
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. '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.
Scenurlo : Web xerver wlthout un uppllcutlon xerver
n 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.
Scenurlo : Web xerver wlth un uppllcutlon xerver
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.
n 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. nstead, 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. n 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.
aveats
#ecently, 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. nstead, 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

App||cat|on 8erver vs web 8erver


A web server car oe e|lrer a corpuler prograr or a corpuler rurr|rg a prograr lral |s respors|o|e lor accepl|rg lTTP
requesls lror c||erls, serv|rg oac| lTTP resporses a|org W|lr opl|ora| dala corlerls, Wr|cr usua||y are Weo pages sucr as
lTVL docurerls ard ||r|ed oojecls or |l. Ar app||cat|on server |s lre ||rd ol sollWare erg|re lral W||| de||ver var|ous
app||cal|ors lo arolrer dev|ce. ll |s lre ||rd ol corpuler lourd |r ar oll|ce or ur|vers|ly relWor| lral a||oWs everyore |r lre
relWor| lo rur sollWare oll ol lre sare racr|re.
A Weo server ard ar app||cal|or server ray d|ller or lre lo||oW|rg po|rls:
Corpar|sor crarl
lrprove lr|s crarl
App||cat|on 8erver web 8erver
what |s |t?: A server lral exposes ous|ress |og|c lo c||erl
app||cal|ors lrrougr var|ous proloco|s
|rc|ud|rg lTTP.
A server lral rard|es lTTP proloco|.
Funct|ons: To de||ver var|ous app||cal|ors lo arolrer
dev|ce, |l a||oWs everyore |r lre relWor| lo
rur sollWare oll ol lre sare racr|re.
Keep|rg lTVL, PlP, A3P elc l||es ava||ao|e
lor lre Weo oroWsers lo v|eW Wrer a user
accesses lre s|le or lre Weo, rard|es lTTP
requesls lror c||erls.
Funct|ona||ty: Adds lurcl|ora||ly 0oes rol add ary
lrprove lr|s crarl
App||cat|on 8erver web 8erver
|ntroduct|on (from
w|k|ped|a}:
Ar app||cal|or server |s a sollWare lrareWor|
lral prov|des ar erv|rorrerl |r Wr|cr
app||cal|ors car rur, ro raller Wral lre
app||cal|ors are or Wral lrey do.
weo server car reler lo e|lrer lre rardWare
(lre corpuler) or lre sollWare (lre corpuler
app||cal|or) lral re|ps lo de||ver corlerl lral
car oe accessed lrrougr lre lrlerrel.
Job: app||cal|or server |s used lo serve Weo oased
app||cal|ors ard erlerpr|se oased
app||cal|ors(|.e sev|els, jsps ard ejos...).
oecause app||cal|or server corla|rs Weo
server |rlerra||y.
Weo server |s used lo serve Weo oased
app||cal|ors.(|.e serv|els ard jsps)
Examp|es of popu|ar
server products:
3ur Java App||cal|or server, Weo|og|c server,
Apacre 0eror|ro
Apacre, V|crosoll ll3
6||ents can |nc|ude: 0ul's, weo 3ervers weo oroWsers, searcr erg|re roools

Funct|on
Tre ra|r lurcl|or ol a Weo server |s |eep|rg l||es acl|ve lor Weo s|le oroWs|rg, lWerly-lour rours a day, sever days a Wee|. Ary
l|re |osl |s |roWr as doWr l|re Wr|cr rears lral al lral po|rl, lre Weos|le ard |ls pages W||| rol oe v|eWao|e. Ary good Weo
rosl|rg corpary lr|es lo |eep lre|r doWrl|re lo |ess lrar a lracl|or ol a secord lo oe successlu|. Ar App||cal|or server
lac|||lales lr|s process ard lr|es lo ra|e lor easy dala access ol ar app||cal|or.
E0|T Hu|t| Thread|ng
Tre weo 3erver does rol supporl lre corcepl ol ru|l|-lrread|rg. lr App||cal|or 3erver We rave lealures |||e correcl|or poo||rg,
|so|al|or poo||rg, ru|l|-lrread|rg, ard rajor|y lre Trarsacl|or lealure Wr|cr |s rol lrere |r weo 3erver.
weo servers (progrars) are supposed lo serve requesls qu|c||y lror rore lrar ore TCP/lP correcl|or al a l|re.Cors|der lral
lrlerrel Exp|orer or F|relox weo 8roWser |s a |oca| prograr or lre user's rard dr|ve, Wrereas lre Weo pages lrerse|ves are
rol. Tre Weo pages are aclua||y slored or lre rard dr|ves ol olrer corpulers, ard lrese are |roWr as Weo servers. App||cal|or
server producls lyp|ca||y ourd|e r|dd|eWare lo erao|e app||cal|ors lo |rlercorrur|cale W|lr deperderl app||cal|ors, |||e weo
servers, dalaoase raragererl syslers, ard crarl progrars.
E0|T Load L|m|t
A Weo server (prograr) ras del|red |oad ||r|ls, oecause |l car rard|e or|y a ||r|led ruroer ol corcurrerl c||erl correcl|ors
(usua||y oelWeer 2 ard 0,000, oy delau|l oelWeer 500 ard 1,000) per lP address (ard lP porl) ard |l car serve or|y a cerla|r
rax|rur ruroer ol requesls per secord. 0r lre olrer rard, ar app||cal|or server ras a rucr r|grer capac|ly.
E0|T Hode|
weoserver de|egal|or rode| |s la|r|y s|rp|e, Wrer lre requesl cores |rlo lre Weoserver, |l s|rp|y passes lre requesl lo lre
prograr oesl ao|e lo rard|e |l (3erver s|de prograr). ll ray rol supporl lrarsacl|ors ard dalaoase correcl|or poo||rg. weo
servers supporl lo dep|oy .War l||es or|y Wr||e App||cal|or servers supporl lo dep|oy .War ard .ear l||es.
App||cal|or server |s rore capao|e ol dyrar|c oerav|our lrar Weoserver. Ar app||cal|or server car oe corl|gured lo Wor| as a
Weoserver.
E0|T h|story
Tre l|rsl Weo server oWes |ls or|g|r lo T|r 8errers-Lee Wrer as parl ol a reW projecl lo r|s erp|oyer CERN (Europear
0rgar|zal|or lor Nuc|ear Researcr). lr 1989 re Wrole lWo progrars Wr|cr |ed lo lre |rp|ererlal|or ol lre l|rsl Weo server. Tre
App||cal|or server l|rsl care up |r lre 1990's.
ll car oe sa|d lral a weo server |s a suosel ol ar app||cal|or server. App||cal|or servers ard Weo servers are oeg|rr|rg lo o|ur
|rlo eacr olrer W|lr lre expars|or ol lre lrlerrel ard weo 2.0 lecrro|og|es. lr rosl |rslarces currerl|y, sollWare |s rosled or
Weo servers, ard lrer doWr|oaded lo lre |oca| rard dr|ve, Wrere |l |s |rsla||ed or lre |oca| corpuler. lr lre reW rode| lral luses
lre Weo server ard app||cal|or server, lre sollWare Wou|d oe rosled or||re ard lre user cou|d access |l ard use |l as reeded,
gerera||y, al a |oWer rale lrar |l re or sre Were lo purcrase lre sollWare reW.

You might also like