Is there anyone that is running Resin on multiple CPUs that could tell
me if you did some special configuration to get this going?

We are currently running Resin 3.1.8 under Red Hat Enterprise Linux 5.3
and we are evaluating using multi CPU servers for running Resin, but it
just doesn't work.
When running standalone Java applications we get multi CPU use,
confirmed with both "sar" and the test class below. When running the
same test (in a JSP) under Resin only one CPU is used.
Why??? Is there some additional configuration we have to do?
(It shouldn't be a licensing issue since we have a 4 CPU evaluation license)

import java.lang.management.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicLong;

public class MultiCoreTester {
  private static final int THREADS = 8;
  private static CountDownLatch ct = new CountDownLatch(THREADS);
  private static AtomicLong total = new AtomicLong();

  public static void main(String[] args) throws InterruptedException {
    long elapsedTime = System.nanoTime();
    for (int i = 0; i < THREADS; i++) {
      Thread thread = new Thread() {
        public void run() {
          total.addAndGet(measureThreadCpuTime());
          ct.countDown();
        }
      };
      thread.start();
    }
    ct.await();
    elapsedTime = System.nanoTime() - elapsedTime;
    System.out.println("Total elapsed time " + elapsedTime);
    System.out.println("Total thread CPU time " + total.get());
    double factor = total.get();
    factor /= elapsedTime;
    System.out.printf("Factor: %.2f%n", factor);
  }

  private static long measureThreadCpuTime() {
    ThreadMXBean tm = ManagementFactory.getThreadMXBean();
    long cpuTime = tm.getCurrentThreadCpuTime();
    double junk = 1;
    for (int j = 0; j< 18; j++) {
      for (int i = 0; i < 100000 * 1000 * 1000; i++) {
        // keep ourselves busy for a while ...
        junk = junk + i-i;      
      }
    }
    System.out.println("junk = " + junk);
    cpuTime = tm.getCurrentThreadCpuTime() - cpuTime;
    System.out.println(Thread.currentThread() + ": cpuTime = " + cpuTime);
    return cpuTime;
  }
}

-- 

  </Mattias>



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to