Log the Bandwidth usage and request time in ASP.NET 4.0
I am writing an ASP.NET application that will keep track of bandwidth being used as well as the time taken by every request.
Since my application is going to be hosted on shared servers so that i want to do every thing in ASP.NET itself and not on the IIS level.
Though there are something called performance counter but they tell about the memory issues.
I only want that total bandwidth consumed in specific day. AND Which page take how much time?
Now i am planning to write every request time and bandidth consumed for every request in Sql Server Database. Am i right or will i be encounter some critical issues by dong this?
I have googled it for too long but dont find what to do in my case?
Any help is appreciated
Thank You
EDIT
I want to show the bandwodth details and time taken by the pages to load on the same website itself so that the admin can see what is going on?
Writing to a database on a busy site might cause you other problems (and require a well turned server with good hardware.)
Instead, simply turn on IIS logging, then parse your logs with a tool such as LogParser 2.2(free)
Enable or Disable Logging (IIS 7)
Advanced Logging for IIS - Custom Logging
Also, check out the performance counters targeting ASP.NET:
Performance Counters for ASP.NET
Monitoring ASP.NET Application Performance
Related SO Questions:
Bandwidth Monitoring in asp.net
What is the most accurate method of estimating peak bandwidth requirement for a web application?
you might want to take a look at mini profiler. The project name is mvc-mini-profiler, but actually it goes to asp.net as well. Although it doesn't detect how much bandwidths used, but you could customize it easily.
this is also a NuGet package for this
I was in the same situation and just coded my own solution. For a low-traffic site, as yours must be (shared hosting), SQL performance will not be a problem.
Simply hook up the Application_Begin and Application_End events and log the URL and the time between those two. For measuring the size of the responses look at http://msdn.microsoft.com/en-us/library/system.web.httpresponse.filter.aspx. This will not count HTTP headers but they won't be especially big.
链接地址: http://www.djcxy.com/p/57660.html上一篇: 这怎么能被阻止?