Hi guys,

I am trying to write a VB.net application that is used to test the performance of a POA, by creating multiple logins from the same account, and sending messages. It has a defined number of test cases, which it repeats with increments. For each case, it will measure the time delay between sending and receiving, and output a results on a table.

I know this might not be the most useful project, but at least it can give admins some accurate figures that correspond to their particular systems. This is the basic algorithm for it:
1) get login credentials, testcases, testmessages, and increment from the user
2) create an array of GW account objects that correspond to the same user, just to simulate large number of connections to the POA.
3) iterate through this array, and send <# of test messages> from each account element in the array
4)repeat for <# of testcases> and incrementing the number of logins by <increment>

The problem happens at step 3, I was thinking of sending the messages in parallel (using threading). at step 3, i created an array of threads of size logins * test cases, iterate through each element and start the thread which will run a function that sends a message. I noticed that each thread lags very long at a place in the send message function. this does not happen if i repeatedly call the function instead of assigning a thread to it. I have tried locking, to prevent possible race conditions, using synclock at the beginning of the function, but to no avail.