Freigeben über


ASP.NET Performance: Web Application Gets Slow Periodically – “Sudden” Traffic Spikes

A customer complained that his web application gets slow each morning at specific times. The rest of the day the application was providing satisfactory performance in terms of response time.

The assumption was that at that times all employees sign in creating unexpectedly high traffic which caused the slow response

We needed to verify it. We needed to build simple histogram that would show the distribution of hits throughout the day. This is what we have done to achieve this.

Prepare IIS logs using Log Parser

Using Log Parser we prepared IIS logs. By “prepared” I mean we consolidated multiple logs into single one. We also removed unnecessary fields making the resulting file smaller. In fact, we needed only time field. Here is the sample LogParser query that retrieves only time for each entry in the log and stores it in Time.log file. Here I assume that all the log files are named ex<something>.log:

LogParser –i :IISW3C "SELECT time FROM ex*.log" -q >Time.log

Analyze IIS logs using Excel

While it is possible to write a more complex grouping query including creating graphs using LogParser but I just think Excel is perfect tool to create graphs, eh? This is what we have done:

  1. Opened the Time.log file inside Excel.

  2. Created another column with the formula similar to this: =CONCATENATE(TEXT(A2,"hh"),":00"

    image

  3. Inserted a pivot table like that:

    image
    image

  4. Inserted graph like that

    image

  5. Like it? See when most hits happened? Does it match when the customers complain that the system slow? Now you are able to explain this to your manager or customer too.

LogParser Only Shortcut

Sorry I made you read thus far. Can’t help – love Excel pivot functionality ;)

You could use this simple LogParser query to get same results without Excel:

LogParser –i :IISW3C "SELECT count(*) as hits, TO_STRING (time,'hh') as hour FROM ex*.log group by hour"

The result would look similar to this:

hits hour
------ ----
111527 11
114283 12
27721 13