IIS Monitoring & performance

Omid Eidivandi (XaaXaaX)
3 min readOct 3, 2021

--

Recently, i was asked by one of the .Net development teams about IIS performance & monitoring , during the discussion i got that they are not familiar with all the application metrics when monitoring IIS , they was aware of CPU , Memory , average Response time but it’s not all in a modern Microservice architecture.

Let’s review some of the Modern Microservice Features.

Microservice Features :

  1. Optimized Operations.
  2. Multi-Tasking
  3. Domain Focused(Context Boundary focused)
  4. Loosely Coupled
  5. Automated CI/CD
  6. Dedicated DataBase (RDBMS or NOSQL)
  7. Auto-Scaled without whole system interruption
  8. Agility

While looking at this list there are two parts : Technical and Organizational

Now let’s have a look at the Microservices on IIS and the elements to consider while maintaining.

IIS considerable elements:

  1. Request/s
  2. Bandwidth and Throughput
  3. Memory
  4. Cpu and Process (including logical process)
  5. Threading
  6. Sessions
  7. Queue
  8. Workers
  9. Total, Accepted and rejected requests
  10. Http.Sys

Now we take a look at IIS web processing.

IIS Process :

Add alt text

This is a simple schema from Microsoft

  1. When a client browser initiates an HTTP request for a resource on the Web server, HTTP.sys intercepts the request.
  2. HTTP.sys contacts WAS to obtain information from the configuration store.
  3. WAS requests configuration information from the configuration store, applicationHost.config.
  4. The WWW Service receives configuration information, such as application pool and site configuration.
  5. The WWW Service uses the configuration information to configure HTTP.sys.
  6. WAS starts a worker process for the application pool to which the request was made.
  7. WAS do health-check pings on application pool in predefined interval(You can modify it)
  8. The worker process processes the request and returns a response to HTTP.sys.
  9. The client receives a response.

By understanding the IIS important elements, now we can go to details of Monitoring

Monitoring:

While monitoring IIS projects we have to consider wider range of monitoring as IIS web process consists of Http.Sys, caching and etc..

Let’s get into details step by step :

The Incoming requests monitoring contains 5 parts as Http.Sys(which is not in user mode), WWW, WAS, IIS application pool(which is in user mode) and Http service Queue .

All Incoming Requests need to traverse the http.sys service , the HTTP.Sys service is call HTTP Service and it’s not compatible with Asp.Net Core Module as .Net core is based on kestrel by default but you can setup the Http.sys, you can also monitor the kestrel.

Use PerfMon on Windows server to get details for incoming requests , add from the Performance Counters Http Service then you can add Get/Post/Options requests or active connections.

If you use request caching consider using the HTTP counter, this let you have the requests which could be part of Http.Sys caching and did not reached the user mode service(IIS worker)

You have to consider Http Service URL group counter as well , just discover your app groupid by running following command

netsh http show servicestate

Also you can monitor the Http Service Queue to see the statistics about requests in the queue, normally IIS handle a request per Logical process , for example if your server has 8 vCpu and 2 logical process per vCpu(this is the normal count in majority of cases but based on server you can have 4 ones) , IIS will queue 6 requets in 3 vCpus as the principle one is owned by the main thread but if you use the multi tasking using async/await in your code it could runs up to 10 requests at the time.

To monitor the WAS use WAS_W3WP counter to achieve the incoming requets from HTTP.Sys which go to IIS worker

Also to get more visibility over WAS use the W3SVC_W3WP to achieve details like threads active , requests active and 4XX and 5XX statistics

Also we need to have a look at ASP.NET v4.0.30319 counter , this give us the statistics about all applications running with an net 4 application pool or use the ASP.NET counter to have the visibility about both v2 and v4 of app pools.

Application ASP.NET counter also can be used to have IIS and Apps visibility.

--

--

Omid Eidivandi (XaaXaaX)

i'm a technial lead , solution/softwatre architect with more than 20 years of experience in IT industry,, i m a fan of cloud and serverless in practice