On Tue, Dec 8, 2009 at 05:11, partysoft <partys...@gmail.com> wrote: > > I am looking for a solution to limit the bandwith for the users of a site > that have access to some mp3 / subscription. I don't want to serve files > through PHP, but directly with some apache module.. > do i have to count every bit? or how this should be handled. I have all the > info on a mysql DB. > Thank you so much for your replies.
This kind of functionality, in my opinion, is better implemented at transport level and not at application level. I've done something similar, but more primitive, i.e. the cumulated bandwidth of all connections to port 80 was capped, using traffic shaping in the linux kernel. The network packets are classified with iptables and then each class can be given a different queueing policy with tc. Check http://lartc.org/howto/, chapter 9. I didn't do it per user, but I suppose one can easily do it per client IP address. I admit that maybe this approach is not suitable when you identify users with some data token at application level. S