問題描述
Một cách thanh lịch để theo dõi thời gian phản hồi trung bình trong IIS 7.5 là gì? (What is an elegant way to monitor average response times in IIS 7.5?)
I have a SaaS application running on .NET and IIS 7.5. I'd like to monitor average server response time and send an alert if it exceeds a given threshold. What are some elegant ways to do this?
I've thought of a few ways already, but I wanted to get others' opinions before I start down any of these tracks.
Some kind of server log parser. Seems the most obvious, but it may be somewhat difficult to extract the metric I'm looking for.
NuGet .NET HTTP module. Are there any NuGet packages that implement response time monitoring and alerting? I couldn't find one.
Custom .NET HTTP module. Monitor the page render time, send an email if it exceeds a threshold. This is probably the most flexible solution but requires some implementation work.
Performance counters. Seems there should be a performance counter for this, but I've never had much luck using the Performance Monitor. Specifically, I don't like re‑adding all the metrics every time I launch it. I can't really make Performance Monitor automatically send an email either.
Are there others I haven't thought of? What approach seems the easiest to implement and maintain? Have you tried this yourself?
參考解法
方法 1:
I’d go with #2. HTTP module can be used to store request start and request end and store it into database.
Then I’d have a separate job that would read the database every X minutes, average the data and send the report. Now that you have the data in your database you can have fun and create all kinds of reports (such as busy hours of the day, requests that are running the longest, clients that are having the most intensive requests etc…)
IMHO this is better than perf counters because it would give you more precise data and you don’t need to set it up every time.
(by Mike、David Smithers)