Don Schwarz > Apache-Throttle-0.03 > Apache::Throttle

Download:
Apache-Throttle-0.03.tar.gz

Dependencies

Annotate this POD

Related Modules

Apache::Traffic
IPC::Shareable
more...
By perlmonks.org

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Apache::Throttle - Apache/Perl module for speed-based content negotiation

SYNOPSIS ^

    PerlTransHandler   Apache::Throttle

    # See the Apache::Throttle::Log manpage for options...
    PerlFixUpHandler   Apache::Throttle::Log

DESCRIPTION ^

Apache::Throttle is made up of two separate modules.

Apache::Throttle is responsible for negotiating the content of certain requests based on the speed of the connection. It does this by checking each request to see if it passes the following criteria:

If the request passes, Apache::Throttle will open the .throttle file and read a number from it. This is the time (in seconds) that the requested file should take to send, ideally. It then takes the sizes of each of the files in the directory (ignoring any that start with a period) and calculates the speed required to send the file to the client in under the specified number of seconds. Finally, it predicts the speed of the current connection and maps the request to point to the largest file that can still be sent in the ideal time.

This implementation allows you to create a virtual copy of a file simply by dropping the different versions of the file into a directory in your HTML tree with same name that you want the file to have. These files can be named anything you want, although they should end in the same extension for MIME-type mapping to work properly. A script, throttleimg, is provided which automatically sets up this directory structure from an existing GIF or JPEG image.

Apache::Throttle::Log is responsible for measuring the speed that other requests are transmitted at and calculating the average transmittion speed for each connection. This information is used by Apache::Throttle by default, but it can also be accessed by other modules. See Apache::Throttle::Log for more information.

OPTIONS ^

This option can be set with the PerlSetVar operative in one of your Apache configuration files.

ThrottleDebug

Prints extra debugging information to the error log.

PredictSub

Sets the subroutine called to predict a connection's speed. This defaults to Apache::Throttle::Log::predict_speed. If the package that the specified subroutine is in can be determined, it will be required automatically.

IDEAS ^

This doesn't only work with images. It can also be used to send different quality audio files, animations, etc. You can even use a directory named index.html if you want, with two different HTML pages for high- and low-bandwidth users. The possibilities are endless. If you think you've used this is a way no one has though of before, mail me. I'd love to hear about it.

AUTHOR ^

Don Schwarz <dons@xnet.com>

SEE ALSO ^

Apache::Throttle::Log, throttleimg, 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.

syntax highlighting: