Squid + Delay Pools =================== Shanker Balan http://shankerbalan.com/ Overview (from webmin help) ======== Delay pools provides a means a restrict bandwidth usage of clients. With delay pools, clients can be restricted at the individual level, or in groups. ACLs are used to apply bandwidth limits to users. The following recipe implements a network wide limit on the bandwidth usage to 64kbps with an overall strict limit also set to 64kbps. The Webmin Squid configuration module is very useful for configuring delay pools if this functionality has to be provided in the hands of an end user. ### ### squid/squid.conf ### # # Class 1 delay pool # acl lan src 192.168.1.0/255.255.255.0 acl intranet dst 192.168.1.0/255.255.255.0 delay_pools 1 delay_class 1 1 delay_parameters 1 8000/8000 delay_access 1 allow lan !intranet delay_access 1 deny all delay_initial_bucket_level 50 "delay_access 1 allow lan !intranet" is to ensure that only traffic originating from the Internet is subjet to rate limiting and not the local Intranet traffic. A download from http://downloads.com/ will be rate limited to 8Kb/s while a download from http://192.168.1.x/ will not. # # Class 2 delay pool # # I use this at work, every one is limited to an individual bucket 7.5Kb and # the aggregate bucket is set to 11Kb. Keeps interactive ssh sessions snappy on # your 16Kb DSL link # delay_pools 1 # class 2, individual limit + aggregate limit delay_class 1 2 delay_parameters 1 10000/11000 7500/7500 delay_access 1 allow lan !local-intranet delay_access 1 deny all delay_initial_bucket_level 0 The delay pool counter can be viewed using the cachemgr.cgi script via the browser. http://proxy.mydomain.com/cgi-bin/cachemgr.cgi?host=localhost&port=3128&user_name=&operation=delay&auth= ### ### Notes ### - Squid must be compiled with --enable-delay-pools - The delay pool counters are not measurable via SNMP, AFAIK. - "delay_initial_bucket_level" is not very clear to me. I have set it to zero as I feel it improves interactivity. ### ### ToDo ### - Can the queing schedular be changed? - Can you do fairness queing so that no one person can hog the entire bandwidth? I think I will have to resort to class 2 delay pools for that. But even then, I dont think I can give equal costs to every host to divide the bandwidth proportionally to every host currenlty "seen" by the cache. Changelog: * Thu Nov 20 13:16:20 IST 2003 - Adding a class 2 delay_pool example * Tue Jun 10 12:57:44 IST 2003 - Exclude LAN traffic from delay_pool * Fri Jun 6 14:30:37 IST 2003 - Initial commit