Re: singe thread per connection
- From: Neil Coffey <neil.coffey@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 12 Jul 2008 20:52:49 -0500
Peter Duniho wrote:
Is that in Java? The limit comes from the size of the stack allocated for a thread (1MB by default) and the maximum virtual address space for a process (2GB).
Ah, Java sets a default stack size of 256K, though you can configure
as a JVM parameter (and from Java 5 onwards you can override in the
Thread constructor). Yes, now I do the calculation, that means my 5,600
threads need about 1.4Gb just for their stack space. Yerk!
It's possible that Java's NIO classes use this mechanism on Windows (known as "I/O Completion Ports"). I don't really know.
NIO uses the plain old select() function. To use I/O completion ports
you have to write native code yourself -- though I guess somebody's
released a library to do this by now. (And yes, you can get
a severalfold reduction in CPU usage compared to using NIO by doing
this.) However, if I remember my figures correctly NIO can still service
a couple of thousand connections in a few % of CPU usage on what's
nowadays a fairly average machine. So OP, if you're still listening,
NIO should be good enough for your 500 telnet connections.
Neil
.
- Follow-Ups:
- Re: singe thread per connection
- From: Arne Vajhøj
- Re: singe thread per connection
- References:
- singe thread per connection
- From: Praki
- Re: singe thread per connection
- From: Peter Duniho
- Re: singe thread per connection
- From: Neil Coffey
- Re: singe thread per connection
- From: Peter Duniho
- Re: singe thread per connection
- From: Neil Coffey
- Re: singe thread per connection
- From: Peter Duniho
- singe thread per connection
- Prev by Date: (www.stefsclothes.com)supply polo Short-sleeved mens (paypal accept)
- Next by Date: Re: trying to get the data off gutenberg's today's rss feed
- Previous by thread: Re: singe thread per connection
- Next by thread: Re: singe thread per connection
- Index(es):
Relevant Pages
|