Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET General (http://www.xtremevbtalk.com/-net-general/)
-   -   multiple WebClient (http://www.xtremevbtalk.com/-net-general/328598-multiple-webclient.html)

Roger-U 03-10-2017 02:20 PM

multiple WebClient
 
I have a program in VB.net 2008 that manages about 6 websites.

So I wrote a little routine to poll them all and measure the response times - typically around 40mS

The polling routine runs in its own thread.

Then I thought "ok, fire off 6 threads and poll them all" .. well it works but the response time is now around 500mS

I experimented with different values for
ServicePointManager.DefaultConnectionLimit and ServicePointManager.MaxServicePoints

but that makes no difference.

Surely I should be able to fire off any reasonable number of webClient requests each on its own thread without that sort of time penalty.

any ideas what I am missing?

Cerian Knight 03-10-2017 10:29 PM

Probably not much help.

I assume each of the 6 threads is not polling all 6, but 1 each (you didn't say that you re-wrote the routine to poll less than 'them all')?

It might be interesting to know if the first one polled is always the first one to respond, 2nd is 2nd, etc?

Motherboard network interface or secondary (add-in) network interface?

Roger-U 03-11-2017 01:37 AM

correct, each thread only polls one site

I can't see any logic to the order they respond.. I suspect it just depends the site's response time (and whether it was asleep!).

But it is certainly not the case the my PC is simply queuing the outgoing messages until each has responded.

I don't have any non-standard hardware.. It's a Dell Inspiron.. admittedly still running Windows 7 profrssional

Roger-U 03-11-2017 05:04 AM

oh dear ... it was me all along :o .. well isn't that usually the case

in the process of trying this out I was too lazy about making the program wait ... to many doEvents were simply hogging the processor

but I did meanwhile discover that WebClient is twice as fast as HttpWebRequest

Cerian Knight 03-13-2017 05:38 PM

Quote:

Originally Posted by Roger-U (Post 1410771)
... to many doEvents were simply hogging the processor

Oddly enough (face-palm), I had that same issue very recently with form responsiveness during writing a 2GB file. Initially I tried increasing the DoEvents frequency... which made the issue even worse.

Falling back to the old rule-of-thumb... more than ~20/second is (usually) unnecessary, and in some cases, detrimental: the form became more responsive and the simultaneous I/O operation completed more quickly.


All times are GMT -6. The time now is 02:12 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.