If you've got N servlet container threads, and all N threads are sitting
there waiting for some external process to complete (a reasonably likely
case under heavy load) no further servlet processing can occur. This is just
thread death, there are no threads available.

Let's suppose my servlet writes requests to a javaspace, and then reads
responses from that javaspace, Further let's suppose that this turn around
takes 5 seconds. Let's say I have 50 threads in the Servlet container. And I
get 500 simultaneous requests (< 1 second).
My server will have characteristics like this:

50 jobs done in ~5 seconds      //50 threads immediately available
50 jobs done in ~10 seconds    //No threads available for 5 seconds
50 jobs done in ~15 seconds    //No threads available for 10 seconds
50 jobs done in ~20 seconds    //No threads available for 15 seconds
50 jobs done in ~25 seconds    //No threads available for 20 seconds
50 jobs done in ~30 seconds    //No threads available for 25 seconds
50 jobs done in ~35 seconds    //No threads available for 30 seconds
50 jobs done in ~40 seconds    //No threads available for 35 seconds
50 jobs done in ~45 seconds    //No threads available for 40 seconds
50 jobs done in ~50 seconds    //No threads available for 45 seconds

Why, because of the synchronous nature of Servlets, I have Monopolized the
Servlet's containers thread pool. Using my scheme (and assuming the server
on the other side of the javaspace is written correctly) I will get:

500 jobs done in ~5 seconds

Sorry but Synchronous servlet's don't scale well. I realize that Application
server providers don't want you to realize this, but it's the truth. If Java
did it right, those who charge thousands of dollars per cpu for application
servers would be mad, because now you just don't "throw hardware at it".
(read: throw money at it).





----- Original Message -----
From: "Pier P. Fumagalli" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 05, 2001 10:22 AM
Subject: Re: Why is servlet API synchronous only?


> Dave Brosius <[EMAIL PROTECTED]> wrote:
> >
> > If my servlet must perform some external process, rmi, sockets, etc. I
> > monopolize the Servlet thread until my process is done, for no good
reason.
> > If n jobs are waiting for the external process to complete, NO THREADS
are
> > available from the Servlet Container pool, and all http-servlet traffic
> > halts.
> >
> > Sorry, but synchronous servlets are a hugh limitation. Obviously my
example
> > was very simplicistic.
>
> "Simplicistic" :) or not, by no means whatever you do with that thread
> implies that the whole HTTP traffic is blocked... Actually, you should be
> still able to process other requests while your is waiting for the
external
> processes to terminate...
>
> I would like to understand what you're trying to do "in toto", because I'm
> sure that it's a problem that can be easily solved with the current API...
>
>     Pier
>
> --
> --------------------------------------------------------------------------
--
> Pier Fumagalli - Sun Microsystems Inc. -
<mailto:[EMAIL PROTECTED]>
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to