When running a server with a large number of sites and using our new Dynamic Worker-Process Page-Out, an administrator might need to figure out what’s going on with the sites for tracking and resource optimization reasons. The simplest way to know of a site going into hibernation is by visiting the event viewer. When IIS puts a site to sleep, it logs an event ID no. 2310, which looks like this:
By querying the event log (with powershell, for example), you can produce a report that lists which sites are getting suspended often. Another type of information you might need is knowing how many of your sites are actually suspended throughout the day. This info can be achieved by examining the Private Working Set Size, which indicates how much memory a process is using. A site that is suspended will typically consume 2-6 MB, while an active site would consume at least 8 MB.
By using WMI to examine the memory usage of all the sites, you can create a data file with this information, which you can later import into something like Excel. Here’s a script for such a thing:
const iForWriting = 2
This script runs in a loop, checking and counting how many sites are suspended and how many aren’t, and dumping the result into a CSV file every minute. After this runs for a certain amount of time (ideally, at least 24 hours), you could double-click the CSV file to open it in Excel, and use the graph functions to produce a graph, like this:
Based on these figures, you can establish your performance data for peak and off-peak hours, and plan your expansion and hardware budgeting properly.
Blog post written by Erez Benari and Ahmed ElSayed