dcsimg
How 2 start Group of threads simultaneously???
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   yossi_dahan
Posted On:   Monday, February 11, 2002 04:51 AM

I'm building a test unit that creates several threads. all those threads needs 2 make a request from a server simultaneously. That's how i'm checking overhead on the server.



I tryed 2 use ThreadGroup but I couldn't find a method that starts all the threads simultaneously. (except ThreadGroup.resume() that is deprecated)

Re: How 2 start Group of threads simultaneously???

Posted By:   Anonymous  
Posted On:   Tuesday, February 12, 2002 09:41 AM

If you're running on a machine with 1 cpu, you actually cannot run two threads at once (REALLY parallell, that is). What happens, is that every running thread gets the CPU for a little while, and this way, the execution is 'interlaced'


You must start your threads one after the other (simply with the start() method). The parallellism is there because the communication to your server will require I/O of some kind, which will block the requesting thread. Another thread from the group then gets the chance to do it's request, gets blocked also, and so on ...

This way, you can test how performant your server is, because many calls are coming in while others are still being processed !


Hope this helps !


Regards,


G√ľnther.

http://www.javacoding.net

About | Sitemap | Contact