Threads limit tweaking

Yo!
On windows2003 with Java 1.4.2 there seems to be a limit o n the number of threads the server can handle (does NOT use NIO).
If you tweak the heapsize and increases the 2GB limit in windows for memory allocation to 3GB we have increased the number of possible threads by approx 20%.
Anyone knows of any other possibilites of increasing this limit?

Yes, several, (not off the top of my head, would need to google for them) but … er… why? It’s usually a waste of time on Windows, unless you’re running a proprietary copy of windows with a better thread scheduler (and/or running the DataCentre edition or similar).

You are suggesting changing to Linux or Sun?

First I would suggest not running more than a hundred threads, ever.

If you aren’t aware of the difference in threading between Windows, Linux, and Solaris then I would hazard you probably don’t need to use all those threads. They are a MASSIVE overhead, unless you’re doing somethign quite special and unusual.

On linux, you have the option of replacing your thread scheduler with any of about 5 competing alternatives (all open source, you just compile different ones in). Some of these can give excellent performance with thousands of threads, but are largely still experimental.

Are you using a server model that creates a thread for each connection? That’s the worst way to design a server that you intend to scale to a large number of connections. I’m assuming that’s what you’re doing since this is the networkin forum. If you are, then is there any reason why you aren’t using NIO? Windows Server 2003 should have no problems with it.

Agree of all above. If we got to choose now we would not go with the current architecture, but… We are currently stuck with the built architecture.
Does anyone know of how to tweak the Win2003 threads limit to the sky?

The short answer, then, is that it’s not going to work. Time to buy a new architecture (license, spend 12 months developing, whatever). You have to face the sad fact that windows can only manage a relatively small number of threads, because of the overhead per thread.

In some cases, you might really really need those threads and be willing to accept the system slowdown.

In others, you might have a better version of windows (nb: Windows 2k-DataCentre used to retail for something like $10,000 per single-CPU license, off the top of my head; not many people have these copies of windows), including some extra tweaks for doing things like running thousands of threads. I’m not saying that solves the problem, just that IIRC they had extra tweaks to mitigate the problems.

In general, windows won’t go above 500-1000 threads without big slowdowns :(.

You could try hacking in a half-cocked pseudo non-blocking system using 100 threads, but it would be less hassle probably just to convert to NIO.

Oh, and there are some 3rd party libs to do this that might still be in existence, but most disappeared when NIO came out because it does the same stuff but faster more efficiently and with fewer bugs. Might be worth googling, but you might not get any support

Ok, thanks for the response!