RedHat9 + Sun JDK 1.4.2_1 + NPTL = issues

S

Sacha Prins

Hi,

These 2 newsgroups (redhat.kernel.general, comp.lang.java.programmer)
seem like the apropriate place for my contemplations, if I'm at the
wrong place please direct me to the right one.

I'm trying to get as many Java threads as possible running on my Linux
box. Using RedHat 7.2 (2.4.18-24.7.xsmp) and with the right JVM (Sun
1.4.2_1) parameters (-Xss, -Xms, -Xmx) I have a fairly stable production
system that will scale up to 800 threads without significant problems.
This however is not enough for me on the long run.

I'm a loyal reader of The Volano Report [http://www.volano.com/report/]
and The C10K problem [http://www.kegel.com/c10k.html] for some time now
and after running across this victorious article about the latest JDK
and the NPTL in RedHat9
[http://developer.java.sun.com/developer/technicalArticles/JavaTechandLinux/RedHat/]
I thought that the scalability problem of Java on Linux was solved.
After some testing (see attached Test.java) I was disappointed to see
that after creating just a little under 3000 threads (that basically do
nothing) the JVM threw this dreaded "java.lang.OutOfMemoryError: unable
to create new native thread" exception again while 'free' still reports
loads of free memory. The -Xss, -Xms or -Xmx parameters to the JVM don't
seem to do anything for me (any parameter value still causes the
Exception at roughly 3000 threads).

What gives? The article about the new JVM with the new RedHat promises a
lot (eg. No limits on the number of threads), but when put into test
does not yet deliver. Do I need to tweak kernel parameters to allow for
more threads? If so, where do I do this?

For those that wonder why I need so many threads; I run a java HTTPD
where any request is a call to a servlet, each call needs a Thread. I
handle a lot of requests. For the CPU this is not an issue, the calls
are very thin. However, the Thread management in Linux does not seem to
be suitable for this kind of scaling (yet?).

I would be glad to come across someone with the same problem and other
views on this issue. I've been working with Java for more than 5 years,
starting on OS/2 and now using Linux as host OS. And my needs always
seem to just a tad ahead of the possibilities.

Sacha


public class Test implements Runnable {


public void run() {
while (true) {
try {
Thread.currentThread().sleep(750);
}
catch(Exception e) {}
synchronized(mutex) {
n++;
}
}
}

public static void main(String[] argv) {
for (int i=0; i<= 3500; i++) {
if (i % 100 == 0) {
try {
System.out.println("Threads: " + i);
Thread.currentThread().sleep(1000);
synchronized(mutex) {
System.out.println("n: " + n);
}
}
catch(Exception e) {}
}
Thread t= new Thread(new Test());
t.start();
}
for(;;) {
try {
Thread.currentThread().sleep(1000);
synchronized(mutex) {
System.out.println("n: " + n);
}
}
catch(Exception e) {}
}
}

static int n=0;
static Object mutex= new Object();

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top