On Mon, 31 May 1999, Bernhard Fastenrath wrote:

> Michael Sinz wrote:
[ snip ]
> > Second, Java has threads built in.  Why not use them?
> > One of the really nice parts of Java is that it has some
> > of these concepts, such as threads and synchronization
> > built in.  This is part of the language specification.
> > One should use those mechanisms.
> 
> Using a thread for each filedescriptor is a waste of
> resources. I really don't understand why there's no 
> mechanism similar to select() in Java.
> I might want to wait on several hundred sockets and
> assign the connection to a thread from a thread pool
> as soon as there's work to do.

In very large servers you hit a scaling problem in Java.  Most virtual
machines currently are limited to ~1000 threads per process.

Since each thread has stack space and context, it is resource intensive to
use threads.  Thread pools alleviate but do not eliminate the problem.

One big downside is that you have to tie up a thread to both incoming and
outgoing streams for fully asynchronous I/O.  That's two threads per
connection right there, a lot of overhead.

At least one company I know of has been forced to a custom JVM
(Hewlett-Packard's) in order to get acceptable performance out of a
Java-based server, and they basically made an interface to select(). 
I believe they've submitted a proposal to Sun also.  And according to
them, the Sun engineers are amenable to doing something about this.

. . . Sean.


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to