Jason Keats
10/16/2008 9:30:00 AM
sternr wrote:
> Hey,
> I use HttpWebRequest to poll data from a local web page using the GET
> mechanism, but no matter how fast or small my request is, the time it
> takes to create and get the response is always at least 200-ms even
> from my local (localhost) development server!!!
>
> Here's a code sample:
>
> string fullUrl = "http://localhost/getData?id=2";
> HttpWebRequest request = HttpWebRequest.Create(fullUrl) as
> HttpWebRequest;
> request.Method = "GET";
> WebResponse res = request.GetResponse();
> StreamReader reader = new StreamReader(res.GetResponseStream());
> string result = reader.ReadToEnd();
> reader.Close();
> reader.Dispose();
> res.Close();
> return result;
>
> I'm using .Net 3.5, and the webserver is based on Python CGI libraries
> (GAE), and according to its console the processing time for each
> request takes a maximum of 30 ms.
>
> Are there any performance tweaks necessary for the HttpWebRequest?
> Why is the overhead that big?
>
> Any help?
>
> Thanks ahead
>
> --sternr
>
Assuming the above is running on Windows, that you're using IIS, and
that JIT compilation (and Python script interpretation) have been
eliminated as part of the problem, then I would guess that the use of
CGI is the main reason for the overhead. Using FastCGI, instead, should
help.