The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Apache::Throttle::Log - Apache/Perl module to determine average speed

SYNOPSIS

    <Location /images>
      PerlSetVar       MaxUsers     100
      PerlSetVar       MinSize      100000
      PerlSetVar       MinDuration  0.1
      PerlSetVar       IDSub        Website::Session::session_id
      PerlTypeHandler  Apache::Throttle::Log
    </Location>

DESCRIPTION

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.

OPTIONS

These options can be set with the PerlSetVar operative in one of your Apache configuration files.

ThrottleDebug

Prints extra debugging information to the error log.

MaxUsers

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.

LogTypes

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.

MinSize

The minimum size in bytes that a request has to be for it to be logged.

MinDuration

The minimum time in seconds that a request has to take for it to be logged.

StoreSpeeds

The number of speeds to store for each connection. These are averaged together to predict the speed of the next request.

ContinueChecking

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.

IDSub

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.

AUTHOR

Don Schwarz <dons@xnet.com>

SEE ALSO

Apache::Throttle, mod_perl

COPYRIGHT

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.