Please see http://java.sun.com/developer/technicalArticles/Programming/linux/ Java on linux has been natively multithreaded since 1.3
Please also note that having a max threads of 750 is pretty much gaurtenteed to cause your system to grind to a halt under high load. (Most linux systems I've seen buckle somewhere around a load average of 75 or so, which means 75 threads waiting for CPU time). Bear in mind that if your application is CPU bound, then no more than the number of CPUs you have can exucte threads at once, which on most systems is either 2 or 4 CPUs, so just 2 or 4 threads!! If you have some IO, and there is always some waiting on the OS to deliver network packets, so it's worth queing threads up a bit, but doing much more than 3 or 4 times the number of CPUs you have is only going to cause your system to spend more time in context switches, not in actual work time. Setting maxThreads to 750 is downright irresponsible. A number less than 32 is probably more than your system will ever be able to cope with if you are actualy doing any processing during the course of a request and not just serving static content. (there are some background threads for various things like garbage collection in the JVM and in tomcat, so a few extra are also warranted). If in doubt, go low, and if you aren't getting CPU saturation under high load, tune them up. It's usefull to do 30 seconds of googling to find Suns actual statement prior to posting and demostrating that 'AFAIK' is pretty lame, because you didn't bother to take the time to actualy find out. Alex. On 6/20/06, Mladen Adamovic <[EMAIL PROTECTED]> wrote:
Leon Rosenberg wrote: >> Isn't Tomcat and JVM still single threaded? >> Single thread = single processor usage > I don't think it was ever singlethreaded. And if it were, what would > the Connector setting > in the server.xml mean? > <Connector port="8580" maxHttpHeaderSize="8192" > maxThreads="750" minSpareThreads="25" maxSpareThreads="75" > Max number of Java thread, IMHO. Java thread is not the same as operating system thread. In fact, JVM used to be single threaded on Linux and Windows and I'm not quite sure has it changed recently. So, you might have 800 Java threads but it is still one thread on operating system. When you run "ps aux | grep java" you always see one operating system thread IMHO. It means you don't exploit 4 processors if you have 4. To exploit 4 processors you have to setup 4 JVM (4 tomcat instances) to do round robin. As long as you have 1 JVM active you don't exploit thread level parallelism in operating system. AFAIK -- Mladen Adamovic http://www.online-utility.org http://www.shortopedia.com http://www.froola.com http://www.gift-idea4u.com --------------------------------------------------------------------- To start a new topic, e-mail: [email protected] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
