
|
View Full Version : Installing Mod_Throttle on cPanel
-Ley- 12-06-2004, 07:09 PM | Hello,
I have followed this guide to start with:
http://www.webhostgear.com/160.html
if that link doesnt work try google cache:
http://www.google.nl/search?q=cache:0JLh2NcDpcAJ:www.webhostgear.com/160.html+mod_throttle&hl=nl
Anyways, this ended up nowhere, did not do what i wanted to do.
The thing i want to do is, block all INCOMING and OUTGOING traffic for ALL users
(dream would be for everyone exept root, mail etc) to a limit of 5 mb per second.
This to avoid bandwidth overusage from some users.
Anyone ever worked with this before and knows how to max
all incomign and outgoing traffic for users at 5 mbps?
Thanks in advance :) |
-Ley- 12-07-2004, 11:15 AM
-Ley- 12-09-2004, 04:17 PM | ok i have successfully installed this with the help from google :-)
Some users are now maxed to a certain limit per second :D
And the entire server is maxed to 2TB bw per month.
Cron restarts apache every 1st of the month so the stats refresh for the new month.
It has an web tool to check current usage..etc..etc..pretty nice i must say! |
Blueheaven 12-10-2004, 06:55 PM hi could youuu post your findings on this forum, of how you achieved this, that would be great |
-Ley- 12-10-2004, 07:04 PM Hello!
No problemo!
Do exactly what says here:
http://www.webhostgear.com/160.html
SKIP the part after:
Usage
Best bet is to go to http://www.snert.com/Software/mod_throttle/ and read up on all the options, but I will give you an example of limiting a site, and how to monitor all your throttled sites status.
Edit your /etc/httpd/conf/httpd.conf and locate the virtualhost entry for the site you wish to throttle. Just BEFORE the </VirtualHost> entry, insert:
<IfModule mod_throttle.c>
ThrottlePolicy Volume 10G 30d
</IfModule>
<Location /throttle-me>
SetHandler throttle-me
</Location>
The ThrottlePolicy line is the key. The first number is the amount of data and acceptable letters are G, M and K. The second number is the period and acceptable letters are m, w, d, h, and s.
Then restart Apache (service httpd restart) Now you can go to:
http://throttleddomain.com/throttle-me
And see the status of the throttle.
then continue at:
If you want to be able to see the status of all throttled sites on the server at once, go to the first virtualhost entry in your httpd.conf file (this should be the entry for your server's hostname) and add the following:
<Location /throttle-status>
SetHandler throttle-status
</Location>
Now you have a working mod throttle.
If you want to throttle the full server, you have to add the following at the FIRST <virtual> entry:
<IfModule mod_throttle.c>
ThrottlePolicy Volume 5M 1s
</IfModule>
where 5M is the speed and 1s is the time.
This you can set to for example with 2000 gb bw per month to:
<IfModule mod_throttle.c>
ThrottlePolicy Volume 2000G 4w
</IfModule>
If you want to throttle an account to 5M per 1s so he cannot exceed faster download or upload, do this like described in the link i gave at start of post:
<IfModule mod_throttle.c>
ThrottlePolicy Volume 5M 1s
</IfModule>
More questions? ask ! :)
[Changed [code] to [quote]] |
Blueheaven 12-10-2004, 08:17 PM <IfModule mod_throttle.c>
ThrottlePolicy Volume 1M 1s
</IfModule>
great I'm up to the syntax part
how would you throttle this syntax for each user instead of each vitual directory
and also how can I limit the number of connections to 2 |
-Ley- 12-10-2004, 08:20 PM add it to your entire server,
Just like described above.
In your httpd conf file do the following:
go to the first line that says:
NameVirtualHost xxx.xxx.xxx.xxx:80 (where xxx is your main serve ip)
Add the following:
<IfModule mod_throttle.c>
ThrottlePolicy Volume 1M 1s
</IfModule>
<Location /throttle-status>
SetHandler throttle-status
</Location>
w00t, full server throttled, i would not recommend this though..i had trouble fixing the server after i accidently did 1K instead of 1 M...server crashed..
otherwise there is no other way then manually editting all accounts i guess :S |
-Ley- 12-10-2004, 08:22 PM as per client ip:
ThrottleClientIP size policy limit period
Context: server
Specify the size of the client IP address list and the global policy to be applied to all incoming connections based on information recorded for a client IP address. The policy Concurrent is ignored.
When the list size is greater than zero, then throttling by client IP address is enabled (the default is zero). Requests from a client IP address can be tracked for a short period of time and subject to the policy specified. The period of time that a client IP address is tracked depends on the size of the client IP address list, which is ordered most recent request to oldest. Every time a new client IP address connects, the oldest entry in the list is lost and reassigned to the new client IP address. Every time an existing entry makes a request, it is moved to the top of the list.
more info's http://www.snert.com/Software/mod_throttle/ |
Blueheaven 12-10-2004, 09:09 PM ok great, now this is where I ran into problems last time
and it seems I get the same issue
<IfModule mod_throttle.c>
ThrottleClientIP 1000 Volume 5M 1s
</IfModule> |
Blueheaven 12-10-2004, 09:49 PM I think Ive hit the jackpot
Download manager is disabled and speed is limited to 100k
<IfModule mod_throttle.c>
ThrottleClientIP 1000 Speed 100K 1s
<Location /throttle-status>
SetHandler throttle-status
</Location>
</IfModule>
and this entry anywhere in your httpd.conf file and it should work |
Blueheaven 12-10-2004, 11:09 PM sorry i think i made some errors with the code before
and ive modified it a bit
<IfModule mod_throttle.c>
ThrottleClientIP 1000 Speed 30K 1s
ThrottleClientIP 1000 Volume 500M 1d
<Location /throttle-client-ip>
SetHandler throttle-client-ip
</Location>
</IfModule>
so it should read
(ThrottleClientIP 1000 Speed 30K 1s)
It measures up to 1000 ip's and limits them to a speed of 30kybtes a second
(ThrottleClientIP 1000 Volume 500M 1d)
then it also measures another 1000 ip's and blocks when more than 500M has been taken off in less than a day. Then unblocks when the time has expired.
Does that seem about right, currently im in the testing phase to see how website peformance is going, but if this bit of code comes good, it could save me $350aud as I wont need to upgrade to an extra server. |
Blueheaven 12-11-2004, 12:17 AM doesnt seem to have worked because my friend can download at maximum speed using a download manager, but on http request he gets half speed, i think i need to limit concurrent connections aswell
and also the connections |
Blueheaven 12-11-2004, 05:06 PM ThrottleClientIP was a hack that I regret doing on request during the
development. Its not recommended.
> from doing too much damage. Any hope?
There is always hope.
--
Anthony C Howe +33 6 11 89 73 78
http://www.snert.com/ ICQ: 7116561 AIM: Sir Wumpus
"Will the real email please stand up..."
I saw this in one of my searches on google.
It seems throttleclientip doesnt work
hmm is there anything else I can use, thats been tested and works to
1) throttle each client ip to a certain speed or volume per day
2)throttle each clients ip to a cetain amount of connections
or is their a program that can do both or do I need seperate programs
cheers
It seems my only option is to upgrade the server |
Blueheaven 12-11-2004, 05:40 PM and from another couple of posts, modthrottleip has a bug and caused
lockups on a busy server.
and from andrew howe the creator, he said that when throttleip is used on a global basis it has peformance issues |
RDOSTI 03-10-2005, 01:50 PM Ok can someone give me the instructions i need to put in httpd.conf for the following:
max 40 users at a time, max speed of download 800Kb/sec, max connections by 1 IP is only 1 conection (all this limitations to 1 DOMAIN ONLY) the rest of the sites can work freely without the limitations.
Please help asap |
justbenice 03-10-2005, 07:32 PM It useless if you want to limit anything per ip . Because apache can't detect a real ip from users if they are behind a proxy ( like AOL users ) . |
Blueheaven 03-15-2005, 05:45 PM yes but the percentages of users that are behind proxies are small compared with the people that are not. |
|