Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference in time-taken in IIS and ASP.NET

I'm developing an ASP.NET (3.5) webservice application, hosted on IIS6/Win2003. The webservice logs the timestamp of the call at start and just before the return. This allows me to query the time-taken. I've also added time-taken to the standard IIS log (W3C extended)

The webservice is then stress-tested (5 threads, 200 calls per thread) When comparing the time-taken from IIS with the timetaken in the datase, I see HUGE differences! The time-taken from IIS (which is also the time-take logged by the calling clients) is much higher than the time-take logged by ASP.NET. For example, the time spent according to ASP.NET is 1.7 secs, while IIS logs 12000 (miliseconds)!

What could be a cause for this?

Dummy-code for the service:

[WebMethod(Description = " Main entry point to the service.")]
public string MethodA(string theXmlInput)
{            
    //log first
    StoreInput(theXmlInput);

    //Run the job, should take about 1 sec
    string result = DoIt(theXmlInput);            

    //log output
    StoreResult(result);

    return result;
}
like image 218
edosoft Avatar asked Jul 07 '09 11:07

edosoft


People also ask

What is time taken in IIS?

Time-taken field You can use IIS Manager to select the fields to include in the log file. One of these fields is the time-taken field. The time-taken field measures the length of time that it takes for a request to be processed.

Does ASP.NET use IIS?

IIS is the most commonly used web server for ASP.NET applications in production environments; it's most likely the web server software being used by your web host provider to serve your ASP.NET application.

Are IIS logs in UTC?

IIS logs are helpful in troubleshooting various web application issues. However, they may mislead server administrators by showing the logs in a time zone different than what the server uses. This is because IIS uses UTC time zone by default.

How can I see ASP.NET in IIS?

In Control Panel, click Programs, and then click Turn Windows features on or off. In the Windows Features dialog box, click Internet Information Services to install the default features. Expand the Application Development Features node and click ASP.NET 4.5 to add the features that support ASP.NET.


1 Answers

Your page request comes into IIS (start the IIS timer). Only .NET sections of your code are handed to the .NET framework (start the .NET timer). The .net framework processes logic, and returns the result to IIS (stop the .net timer). IIS then finishes processing the request and sends teh HTTP response back to the browser (stop the IIS timer).

IIS might be doing a whole load of additional work - authentication, handling MIME types, handling content that is not parsed by the .NET framework (HTML, images, flash etc).

I personally wouldn't expect to see these two values aligned.

like image 173
Mark Cooper Avatar answered Sep 30 '22 16:09

Mark Cooper