multithreading doesnt behave itself in tomcat

Hello everyone, greetings this monday morning

I've been working on a web application, and run into a problem which i don't really know where to start with, so i figured i would ask all you veterans (first real job for me) for some advice/help

the situation:

our web app has a pretty pasic MVC structure, one controlling servlet which handles request and calls the bussiness logic, and server the right JSP to the user.

Recently i have added some functions which require iterating over a (potentially) large amount of files and collect all different sorts of statistics. Since the statistics can be roughly divided into three groups, i figured i could use three different Thread classes, one for each type of statistics, so i could take advantage of the fact our production server will be multi-core, thus reducing waiting time for any users calling this function by up to 50% (i could theoretically even scale all the way up to the number of cores on the future server)

now the problem is, in general using this multi threaded approach is slower then calling the threads Run() methods succesively (basically running it single threaded this way) from the main request thread. For some reason my CPU (develloping on a dual core machine) doesnt jump to full load under the multi-threaded code.

At first i theorized that Tomcat simply doesnt allow internal threads for one request to take up more then 1 core in cpu time, but testing revealed that in sometimes (seemingly random) the multi threaded approach is about 10-15% faster then the single threaded version, while at times it can be 30-40% slower

I honestly dont know what to think about this anymore, to me it seems tomcat is messing with the threads

does anyone have any pointers for me?

[1799 byte] By [Vectorizeda] at [2007-11-27 11:22:48]
# 1

I'm not sure that this has so much to do with processor as with memory. You may wish to increase the amount of memory available to tomcat.

What OS is it running on?

uvneta at 2007-7-29 14:56:57 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

this is all on my development machine, running windows XP pro SP2 with all the latest updates. The machine itself has 4 GB of memory installed (and yes i know, XP 32 bit can only adress ~3.5 GB of it)

i dont think memory is a problem, using multiple browser i can launch a huge amount of requests to the same servlet/action, which still wont draw my cpu core up to 100%, it will at best draw tomcat to 80-85% cpu usage, even when processing >10 threads

Vectorizeda at 2007-7-29 14:56:57 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...