"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "mod-cband-0.9.7.5/doc/faq.txt" of archive mod-cband-0.9.7.5.tgz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1
2 mod_cband - A per-user, per-virtualhost and per-destination bandwidth
3 limiter for the Apache HTTP Server Version 2
4
5
6 FAQ
7 =============
8
9
10 1. Apache doesn't serve some vhosts !
11 2. How do I give a common limit to two virtual hosts ?
12 3. How do I limit bandwidth based on the IP address the request comes from ?
13 4. My bandwidth is used up in a week ! Aieeee!!!
14 5. What if I don't need your stinkin' bandwidth limiting and only want to throttle ?
15 6. Can I slow down my pages rather than block them with 509 ?
16
17 --------------------------------------------------------------------------------------
18
19 1. Apache doesn't serve some vhosts !
20 You probably set the scoreboards to the same file. If you need to have a common limit for those vhosts, look below.
21
22 --------------------------------------------------------------------------------------
23
24 2. How do I give a common limit to two virtual hosts ?
25 Create a username and bind both virtualhost with that username, like this:
26
27 <CBandUser myUser>
28 # 100MiB limit, 10 week period
29 CBandUserLimit 100Mi
30 CBandUserPeriod 10W
31 # file for writing down the bandwidth usages
32 CBandUserScoreboard /somewhere/user.myUser.scoreboard
33 </CBandUser>
34 <VirtualHost firstvhost>
35 ...
36 CBandUser myUser
37 </VirtualHost>
38 <VirtualHost secondvhost>
39 ...
40 CBandUser myUser
41 </VirtualHost>
42
43 --------------------------------------------------------------------------------------
44
45 3. How do I limit bandwidth based on the IP address the request comes from ?
46 At the first, you should define a destination class (a set of IP addresses the request comes from) like this:
47
48 <CBandClass myClass>
49 CBandClassDst IP1
50 CBandClassDst IP2/mask
51 CBandClassDst IP3
52 ....
53 </CBandClass>
54
55 Next, you can define a limit for this class:
56
57 <VirtualHost>
58 ...
59 # 1GB limit, 4 week period
60 CBandClassLimit myClass 1G
61 CBandPeriod 4W
62 </VirtualHost>
63
64 --------------------------------------------------------------------------------------
65
66 4. My bandwidth is used up in a week ! Aieeee!!!
67 "This looks like a job for .... THE SLICER !"
68 Seriously now, there's a feature called period slicing which allows you to gradually "give" bandwidth, instead of allowing it to be used all at once.
69 You can divide your limit period into "slices", so that only the limit of one slice can be used until another slice period comes.
70 Example:
71
72 CBandLimit 100Mi
73 CBandPeriod 4W
74 CBandPeriodSlice 1W
75
76 This will create four slices (eg: cut 4 weeks into 1 week long slices).
77 During each slice the effective limit will be increased by 100MiB/4 = 25MiB.
78 During the first week you will have an effective bandwidth limit of 25MiB.
79 This will make sure you have bandwidth for the remaining three weeks :).
80
81 When the second week comes you will have an effective limit of 50MiB, and so on.
82 Finally, in the fourth week your effective limit will be equal to the full limit - 100MiB.
83
84 This doesn't mean unused bandwidth from last week is lost ! If during the first week you use 1MiB, then during the second week you can use up to 49MiB.
85
86 You can even slice the period into 1 day slices, so if a day's bandwidth gets used, you can be sure that your site will be up again in the morning :)
87
88 --------------------------------------------------------------------------------------
89
90 5. What if I don't need your stinkin' bandwidth limiting and only want to throttle ?
91 Then go ahead - don't use bandwidth limiting directives and setup throttling.
92 Example:
93
94 <VirtualHost>
95 ...
96
97 # limit speed of this vhost to 1Mbit/s, 10 request/s, 30 open connections
98 CBandSpeed 1Mbps 10 30
99
100 # in addition every remote host connecting to this vhost
101 # will be limited to 200kbit/s, 3 request/s, 3 open connections
102 CBandRemoteSpeed 200kbps 3 3
103
104 </VirtualHost>
105
106 Note: You don't have to use both directives. You can limit remote hosts without imposing a limit on the vhost or you can limit the vhost without limiting remote hosts.
107
108 --------------------------------------------------------------------------------------
109
110 6. Can I slow down my pages rather than block them with 509 ?
111 The CBandExceededSpeed does just that. When used inside a vhost block it makes mod_cband slow down connections instead of showing clients some defined "bandwidth exceeded" page.
112 Example
113
114 <VirtualHost>
115 ...
116 CBandLimit 100Mi
117
118 # this limit is for when the vhost is still below 100MiB usage:
119 # limit speed of this vhost to 1Mbit/s, 10 request/s, 30 open connections
120 CBandSpeed 1Mbps 10 30
121
122 # ... while this limit is for when the vhost is over below 100MiB usage:
123 # limit speed of this vhost to 32Kbit/s, 2 request/s, 5 open connections
124 CBandExceededSpeed 32kbps 2 5
125 </VirtualHost>
126
127 Note: You don't have to use both *Speed directives.