The difference between a factor of 20 and 6 is only a factor of 3. What about network bandwidth , CPU usage , CPU types etc ?
Also as mentioned remove Priority = Highest . It wont help when you have multiple threads all at highest priority in fact it could reduce performance. the calling thread ( which generates all the other threads ) does not get enough CPU to generate new threads until each one is finished. . Ben -----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED]]On Behalf Of Jesse Sanders Sent: Monday, 10 June 2002 5:52 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Threading is blocking itself or ? Update: Originally, I was trying to make SOAP calls across a VPN from home to work, but I kept getting weird results. I created two methods, one to create new threads and another one which run syncronously. I ran the app from work and both methods submitted all of the requests correctly. When I compared the execution times for both of them, they were almost identical. I am not getting any gain by threading these method calls. 1. I know I should get a gain, because my Java counterparts on the Unix side of the system do exactly this and are able to send over a 100 SOAP requests in under 6 seconds-- its taking me over 20 seconds to do the same thing. 2. I split out my threading routine into its own method: Private Sub ThreadingRequest(ByVal ThreadCount As Integer, _ ByVal strServerName As String, _ ByVal strRequestType As String, _ ByVal strReturnAddress As String, _ ByVal strInputXML As String, _ ByVal lngRequestID As Long, _ ByVal strServerIP As String) Dim Idx As Integer Dim oSoap(ThreadCount - 1) As GFSSoap.SOAP Dim Threads() As System.Threading.Thread If ThreadCount < 1 Then ThreadCount = 1 ReDim Threads(ThreadCount - 1) For Idx = 0 To ThreadCount - 1 oSoap(Idx) = New GFSSoap.SOAP(strServerName, strRequestType, "", strInputXML, lngRequestID, strServerIP) Threads(Idx) = New Threading.Thread(AddressOf oSoap(Idx).SendSingleRequest) Threads(Idx).Priority = System.Threading.ThreadPriority.Highest Threads(Idx).IsBackground = True Threads(Idx).Start() lngRequestID = lngRequestID + 1 Next End Sub I have tried it where I create a new class for each thread and where they all point to the same class instance. The SOAP class just takes the parameters from the constructor and sends a soap request to the server. Does anyone see what I am doing wrong here? This is driving me crazy! Thanks, Jesse > -----Original Message----- > From: Moderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED]]On Behalf Of Jesse Sanders > Sent: Saturday, June 08, 2002 6:53 PM > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] Threading is blocking itself or ? > > > Hi all, > > I searched the archives on threading, but I didn't see > anything close to my > problem. What I am trying to do is send 100 SOAP requests to > a server at > once to stress test it. I wrote it originally in VB6, but > the requests were > getting backjammed, so I turned to VB.Net to solve this issue. > > I have a SOAP class called SOAP, which sends the soap request > to the server. > The soap class takes 6 parameters, so I included them in the > constructor. > The constructor sets 6 private member variables with the incoming > parameters. > > I don't get any errors compile time or runtime, but when I > specify 1 or 100 > concurrent requests, it might send 0 - 4 requests to the > server. I'm not > sure what I am doing wrong, but I know it has to do with the > threading part. > The code works fine without threading, but then gets freaky > when its in > place. > > Any help is appreciated. > > Thanks, > > Jesse Sanders > > Code Snippet: > > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Button1.Click > Dim oSoap() As SOAPTest.Class1 > Dim strServer As String > Dim strServerIP As String > Dim strInputXML As String > Dim strRequestType As String > Dim ThreadCount As Integer > Dim lngRequestID As Long > > Dim selectedIndex As Integer > Dim selectedItem As Object > > Dim Threads() As System.Threading.Thread > > strServer = txtServer.Text > strServerIP = txtServerIP.Text > strInputXML = txtInputXML.Text > > selectedIndex = cboRequestType.SelectedIndex > selectedItem = cboRequestType.SelectedItem > strRequestType = selectedItem.ToString() > ThreadCount = Val(txtConcurrentRequests.Text) > > If ThreadCount < 1 Then ThreadCount = 1 > ReDim Threads(ThreadCount - 1) > > Dim Idx As Integer > lngRequestID = 1234 > > ReDim oSoap(ThreadCount - 1) > > For Idx = 0 To ThreadCount - 1 > > oSoap(Idx) = New SOAPTest.Class1(strServer, > strRequestType, "", > strInputXML, lngRequestID, strServerIP) > > Threads(Idx) = New Threading.Thread(AddressOf > oSoap(Idx).SendSingleRequest) > Threads(Idx).Priority = > System.Threading.ThreadPriority.Highest > Threads(Idx).IsBackground = True > Threads(Idx).Start() > lngRequestID = lngRequestID + 1 > Next > > MessageBox.Show("Done: Sent " & ThreadCount & " requests") > End Sub > > You can read messages from the Advanced DOTNET archive, > unsubscribe from Advanced DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
