Apache::Throttle::Log - Apache/Perl module to determine average speed
<Location /images> PerlSetVar MaxUsers 100 PerlSetVar MinSize 100000 PerlSetVar MinDuration 0.1 PerlSetVar IDSub Website::Session::session_id PerlTypeHandler Apache::Throttle::Log </Location>
Apache::Throttle::Log measures the speed that requests are transmitted at and can calculate the average transmittion speed for a connection.
It isn't particularly accurate yet, but seems to be close enough for most applications. If you know of a better way to measure the speed feel free to send me suggestions, patches, etc.
These options can be set with the PerlSetVar operative in one of your Apache configuration files.
Prints extra debugging information to the error log.
Clear the speed hash when it reaches the specified number of users. I'm still looking for a better way of doing this. If anyone has any suggestions, feel free to tell me. This option is strongly recommended.
Only log requests with a MIME-type that matches this regular expression. This is useful for only logging "^image/" if you plan to serve images and the speeds for other large, compressable files are throwing off your averages. It's probably much more efficient to keep all your images under one directory and just put a <Location> container around the handler definition though.
The minimum size in bytes that a request has to be for it to be logged.
The minimum time in seconds that a request has to take for it to be logged.
The number of speeds to store for each connection. These are averaged together to predict the speed of the next request.
If this is set to a true value, Apache::Throttle::Log will continue logging requests from a user forever. If unspecified or set false, however, it will only log as many requests as StoreSpeeds is set to, and then DECLINED requests from the same user. This should be used when speeds are fairly constant and Apache::Throttle is putting a strain on your webserver.
This specifies the subroutine that Apache::Throttle::Log will get the hash key from. The subroutine will be called with one argument: the Apache request object, and will be expected to return a scalar. This scalar will be used as the hash key to store the connection information. Defaults to the remote IP address for the request.
Don Schwarz <firstname.lastname@example.org>
Copyright (c) 1998 Don Schwarz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.