[web] how do you go about measuring the amount of bandwidth one of your users is consuming
lets say you own a website that hosts images for its users.
How do you measure the bandwidth that one of your users consumes?
C# asp.net
Using a bandwidth auditing tool ofcourse :) There are several for linux, but it's been a few years since i used one, so I don't remember any names.
A quick way to measure bandwidth usage for HTTP connections is just to run webalizer on the access log files.
If you host images and show them through a script (ie, <img src="image.php?user=blahℑ=blah.jpg">), you could just get the size of the image and add the value to a database field every execution of the script.
Quote:Original post by GroZZleR
If you host images and show them through a script (ie, ), you could just get the size of the image and add the value to a database field every execution of the script.
how do you think a service such as photobucket does it? Is it reasonable to assume they use the method above?
Thinking about the options, I'd say that it's a simple way of doing it. However, photobucket uses 'real' urls (instead of a querystring) which leads me to think that probably use a custom ISAPI filter to intercept the request and keep track of the downloads (see interesting article on MSDN).
If you don't have access to the server or can't install an ISAPI component, you could probably 'fake' it by using custom 404's to redirect a request to a DB query. So imagine your user stores an image, the 'real' url to access the image is http://yoursite.com/images.aspx?id=12345 - the custom 404 would take a URL such as http://yoursite.com/users/example/helloworld.jpg and redirect it to the first one through a process of DB lookups and such. The first URL could obviously have some kind of tracker already mentioned which will allow you to monitor the user's data transfer.
If you don't have access to the server or can't install an ISAPI component, you could probably 'fake' it by using custom 404's to redirect a request to a DB query. So imagine your user stores an image, the 'real' url to access the image is http://yoursite.com/images.aspx?id=12345 - the custom 404 would take a URL such as http://yoursite.com/users/example/helloworld.jpg and redirect it to the first one through a process of DB lookups and such. The first URL could obviously have some kind of tracker already mentioned which will allow you to monitor the user's data transfer.
If apache's mod_rewrite is installed on the server then you can use that as well to redirect "real" URL's hrough a database query string.
Get your web server logs. Find some way of identifying which entries are from which user, and then add up the total number of bytes transferred (which should generally be logged).
That gives you the answer.
Unfortunately identifying users is a tad tricky normally - unless you're using HTTP authentication, in which case they should appear in the log.
Mark
That gives you the answer.
Unfortunately identifying users is a tad tricky normally - unless you're using HTTP authentication, in which case they should appear in the log.
Mark
Hmm I don't think I understood the question.
Do you mean:
A) The amount of bandwidth used by an individual user, personally, by downloading stuff from your site
OR
B) The amount of bandwidth used by all users of items which belong to a specific user
B) is easy, A) is hard.
Mark
Do you mean:
A) The amount of bandwidth used by an individual user, personally, by downloading stuff from your site
OR
B) The amount of bandwidth used by all users of items which belong to a specific user
B) is easy, A) is hard.
Mark
Quote:Original post by markr
Hmm I don't think I understood the question.
Do you mean:
A) The amount of bandwidth used by an individual user, personally, by downloading stuff from your site
OR
B) The amount of bandwidth used by all users of items which belong to a specific user
B) is easy, A) is hard.
Mark
sorry for not being clear. (B). I would like to track the bandwidth used by all users of items that belong to a specific user.
Thanks for all the tips in the thread. If anyone has a link to a tutorial that wouyld be great.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement