C H A P T E R
9
Appliation Development
Solutions for the Pratie Exerises of Chapter 9
Pratie Exerises
9.1
Answer :
The
CGI
interfae star ts a new proess to ser vie eah request, whih has a
signiant operating system overhead. On the other hand, ser vlets are r un as
threads of an existing proess, avoiding this overhead. Fur ther, the proess run-
ning threads ould be the web ser ver proess itself, avoiding inter proess om-
muniation, whih an be expensive. Thus, for small to moderate-sized tasks,
the overhead of Java is less than the overhead saved by avoiding proess re-
ation and ommuniation.
For t asks involving a lot of CPU ativity, this may not be the ase, and using
CGI with a C or C++ program may give better per formane.
9.2
Answer :
Most omputers have limits on the number of simultaneous onnetions they
an aept. With onnetionless protools, onnetions are broken as soon as
the request is satised, and therefore other lients an open onnetions. Thus
more lients an be ser ved at the same time. A request an be routed to any one
of a number of dierent ser vers to balane load, and if a ser ver rashes, another
an take over without t he lient notiing any problem.
The drawbak of onnetionless protools is that a onnetion has to be
reestablished every time a request is sent. Also, session infor mation has to be
sent eah time in the form of ookies or hidden elds. This makes them slower
than t he protools whih maintain onnetions in ase st ate information is re-
quired.
59
评论0