This is not a "weak" implementation.  It is simply an implementation
choice.  On Intel hardware, you are effectively limited to about 4000
threads, which is the default in Windows.  If you need to do so, you can
increase the number of task slots available in Linux by editing
"include/linux/tasks.h" in the kernel source and recompiling.

The important constants are NR_TASKS, which defaults to 512, and
MAX_TASKS_PER_USER, which defaults to NR_TASKS/2.  Assuming you are
running jBoss under a dedicated system user account, you can set NR_TASKS
to something like 4000 and NR_TASKS_PER_USER to something like 3800, and
then you will get substantially the same behavior on Linux as you would on
Windows.  Note, however, that this does not _guarantee_ stability of the
system on either Linux or Windows, but simply raises the bar before jBoss
wedges itself and has to be killed externally by the operating system.

Linux is designed with these low defaults on the assumption that any
process that is creating hundreds of threads is going crazy and should be
halted, so this ordinarily improves system stability.  In the case of
jBoss/Tomcat, it is normal behavior to see hundreds of threads created,
and the assumption embodied in the Linux kernel defaults is inapplicable.

One option you do not have with Windows that you do have with Linux is to
set the installed JVM to use "green threads" instead of "native threads."  
This will use an internal scheduler in the JVM to switch between threads,
and they will not consume system task slots.  Green threads are somewhat
less efficient than native threads in most cases, but you may get better
stability by using them under very heavy load.  One disadvantage to green
threads is that, on SMP hardware, all threads within a JVM will be
confined to a single processor, while with native threads different
threads in the same JVM can run simultaneously.

You would be well advised to upgrade to JDK/JRE 1.3.1, which has some
improvements.  You may also want to see that Java is started with the
"-Xincgc" switch, which spreads out the garbage collection penalty and
prevents major bottlenecks from developing that can cause avalanche.

Finally, you may also find that behavior differs between Linux using the
2.2 kernel as opposed to the 2.4 kernel, so you might want to try each if
your distribution supports this.

-- Mike


On 2001-06-28 at 11:32 +0200, Frank Fr�se wrote:

> We have severe problems bringing stability to our Apache/Tomcat/JBoss based
> application on Linux OS. Every thing seems to run stable while traffic is
> low. But when traffic increases the VM forkes hundered of OS processes what
> causes thousands (>40,000) of open files. At the end all OS resources are
> consumed and the application dies.
>  
> I read about Linux's weak thread implementation which uses an OS process for
> each thread. Could this be the source of our problems? Is there a way to
> control this resources greed of our application?
>  
> Our configuration:
>  
>     Linux 2.2.18
>     JDK 1.3.0 (Sun HotSpot)
>     JBoss 2.2.2
>     Tomcat 3.2.2
>     Apache 1.3.19
>  
> Would you probably recommend to better switch to Windows or Solaris OS? If
> so, which is the preferred OS for a JBoss application?
>  
>     - Frank



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to