>>> Gokul Singh <[EMAIL PROTECTED]> 06-Nov-00 9:28:04 AM >>>

>In my understanding of this, the thread pools used in
>the well designed servlet containers ( I have seen paperclips
>source) are dynamic in size and if such a blocking is observed,
>new threads will be created on the fly. The pool may in such a
>situation stabilize at a larger no of threads than initialized with.


That's about it...


>Of course there is a tremendous overhead associated with
>creating new threads

There isn't a "tremendous overhead". There is an overhead but it's
not tremendous. It also depends on what sort of threading system
you're using. In general system level threads (like pthreads) will
take longer to create than green threads (threads "emulated" by the
JVM).

Still, even in such scenarios it is perfectly feasible to not use
thread pools... Tomcat doesn't by default I understand.

It's my view that threadpools are fairly easy to setup and therefore
why not use them? But others don't share that view.


>What can be the disadvantage of situation above?

The disdadvatange is the same as with any thread system, as I pointed
out to Chris.

Chris suggested that a servlet could block thus using up a thread.

In the GNU-SocketServer (the thread pool used in Paperclips) this
will cause new threads to be created to take over from the blocked
one... but then the same servlet could get requested again and block
another thread, causing another increase.

So in the end you end up with a system that is penned in by the
maximum number of threads a single JVM can create.

The same is true of the non-pooled system, creating a thread per
request.

Unless you can get people to write thread-safe and thread-friendly
code there will be a potential problem in any system using threads.


Nic

___________________________________________________________________________
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