7

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?

  1. My web application is going to be hosted on the shared server
Moons
  • 3,833
  • 4
  • 49
  • 82
  • Sorry, I don't understand your question. Are you asking how to measure bandwidth? Or whether writing the data to SQL Server for every request would cause issues (yes, it would), or how to resolve those issues -- or what? What have you tried already? – RickNZ Feb 18 '12 at 06:18
  • @RickNZ I want to show the admin of the website the traffic in the website, thats it. – Moons Feb 18 '12 at 06:21

3 Answers3

2

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)

Also, check out the performance counters targeting ASP.NET:

Related SO Questions:

Community
  • 1
  • 1
Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
  • But i might not have access to turn on IIS logging on shared server as well as i want to show these statistics on a WEB Page in the same site itself. Means my client needs a page to show the stats – Moons Feb 18 '12 at 05:35
  • can you specifically help us in finding out the bandwidth used ? – Pankaj Feb 18 '12 at 05:47
1

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

fengd
  • 7,551
  • 3
  • 41
  • 44
1

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.

usr
  • 168,620
  • 35
  • 240
  • 369
  • you solution is okay, but not very reliable as when the site grows after some time my client might need to convert the shared hosting to dedicated hosting. As per the project there may be millions of transaction per month after few years from now – Moons Feb 19 '12 at 10:25
  • Then you won't run on shared hosting anymore. You can then store the logs however you want, for example as text files. You don't have to use a database. Actually I am running a site which is logging about 3m hits per month in a normal database. It is not a problem at all. The server is unloaded. – usr Feb 19 '12 at 12:24
  • The solution is very reliable and its performance is very good because an insert is not very expensive. – usr Feb 19 '12 at 12:25