tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilbert, Antoine" <>
Subject RE: Tomcat problem on a multiple CPU system
Date Mon, 05 May 2008 00:31:47 GMT
My english is not very good, I'll try to explain again

For example, my test outside of Tomcat

  for(int i=0;i<8;i++){
      Thread t = new Thread(new Runner());

My Runner class do some image rendering test...

If I run this directly using Java.exe all is fine, 100% of the 8 CPU are
used and it run fast..

If I create a JSP and put the Runner code in it, I open 8 browser
windows to launch 8 process via Tomcat, it run slow and it's using like
30% of all CPU...

My rendering process read a small geometry file on disk and render it in
an Image Buffer, it's not IO intense, just pure CPU processing, no
database connection, no network usage, and anyway, whatever this process
do, I can run 8 of them using Java.exe and make them using the 8 CPU,
but with Tomcat this is not working very well...


-----Original Message-----
From: Gilbert, Antoine 
Sent: 4 mai 2008 20:20
To: Tomcat Users List
Subject: RE: Tomcat problem on a multiple CPU system

Well, each process is a image rendering process.

But my point is, if I launch 8 threads directly in a JVM outside of
tomcat, it run faster and use 100% of the 8 CPU...

If I make a Servlet (or a JSP) who will start a process each time I call
it (I call it 8 times). 

So, the big question is, why It's fast directly on the JVM and it's slow
on Tomcat ? Why with Tomcat It's not possible to use 100% of all the 8
CPU ? There is no data transfer between client and server, in both case
the images are rendered on the disk.

I just made this rendering test to expose the fact that I'm unable to
make my tomcat use efficiently all my CPU.

So the big question, why these 8 processes run betters than these 8
process within Tomcat ?

-----Original Message-----
From: Alan Chaney [] 
Sent: 4 mai 2008 17:33
To: Tomcat Users List
Subject: Re: Tomcat problem on a multiple CPU system

Hi Antoine

The thing to remember is that this is a system which has (at least) four

main parts:

1. Tomcat
2. The operating system
3. A network connection
4. Your application

(and potentially)

5. A database (but you didn't mention that)

Here are some questions.

1. How do you make the connection to the servlet. Does the browser run 
on the same machine as the application?

2. Does you application create network traffic? If so, how many bytes 
are transferred to the browser? Each servlet thread will have to wait 
until the application has transferred all the data out.

3. What kind of disk activity does your application generate? Is it 
different when the app is running from the servlet?

Probably somewhere your servlet threads are sleeping waiting for a 
resource. You could do a thread dump to see what is happening (I don't 
use Windows so I can't remember how you do that with the Win setup)

In the end, you'll need to profile the system to work out where the 
bottlenecks are. You'll need to use network analysers and probably Java 
profilers to track down what's happening such as when packets are 
received, when the replies are generated and maybe profile what your 
app. is doing.


Alan Chaney

Gilbert, Antoine wrote:
> Hi
> I have a 2x quad core (8 cpu units) server.
> If I start a java program and this one is launching (at the same time)
> thread doing some CPU intensive jobs, all the CPU are used at 100%,
> that's what I'm expecting..
> But, if I am using tomcat, and I call a servlet 8 times to process
> 8 jobs, it take longer to execute these same 8 jobs and all the CPU
> not used at 100%, it's more like 30%...
> Any idea about this problem or behavior ? I'm using Tomcat 5.5.17,
> windows, JDK 1.6
> Antoine
> !DSPAM:481e1bf27941527717022!

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message