Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2006

Tip: Looking for answers? Try searching our database.

GetResponse delay

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JezB - 06 Mar 2006 00:13 GMT
I do some peeking at files on the web in my program with code such as:

WebRequest wr = WebRequest.Create(url);
WebResponse r = wr.GetResponse();

I've noticed that the first time GetResponse is executed, it takes some 3 to
4 seconds. Repeating the same code in the same run is almost immediate. So
why the delay the first time this is executed on each run? And can I do
anything about it?
Michael C - 06 Mar 2006 03:45 GMT
>I do some peeking at files on the web in my program with code such as:
>
[quoted text clipped - 5 lines]
> So why the delay the first time this is executed on each run? And can I do
> anything about it?

This is a very normal thing for PCs. Haven't you ever used a PC before and
noticed that doing practically *anything* takes longer the first time?

Michael
JezB - 06 Mar 2006 09:32 GMT
I've been using PCs for 20 years pal. Doesn't explain why the same url in a
web browser appears instantly (it's only a small text file) yet GetResponse
takes 4 seconds - there must be a reason for it, and I assume you don't know
it.

>>I do some peeking at files on the web in my program with code such as:
>>
[quoted text clipped - 10 lines]
>
> Michael
SurfNet - 06 Mar 2006 10:04 GMT
> >>I do some peeking at files on the web in my program with code such as:
> >>
[quoted text clipped - 15 lines]
> takes 4 seconds - there must be a reason for it, and I assume you don't know
> it.

I see to possibilities.

1) There is a high overhead setting up the HTTP connection and the second
time its reused...
2) The immediate code is compiled the first time and the second time its
already present. That might be a side-effect of dotNET.
3) A round-trip to the server is expensive and the second time the cache is
used (not too likely that this is the case).

Of course combinations are possible too...

- Joris
Michael C - 06 Mar 2006 22:00 GMT
> I've been using PCs for 20 years pal. Doesn't explain why the same url in
> a web browser appears instantly (it's only a small text file) yet
> GetResponse takes 4 seconds - there must be a reason for it, and I assume
> you don't know it.

It's called cache my friend.

Michael

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.