/perlbal-plugin-mogilefs

Perlbal Plugin to serve data from MogileFS

Primary LanguagePerlOtherNOASSERTION

This is Perl module Perlbal::Plugin::MogileFS.

INSTALLATION

Perlbal::Plugin::MogileFS installation is straightforward. If your CPAN shell is set up,
you should just be able to do

    % cpan Perlbal::Plugin::MogileFS

Download it, unpack it, then build it as per the usual:

    % perl Makefile.PL
    % make && make test

Then install it:

    % make install
    
DOCUMENTATION

Perlbal::Plugin::MogileFS documentation is available as in POD. So you can do:

    % perldoc Perlbal::Plugin::MogileFS
    
    Depending on what implementation your using.

This plugin provides Perlbal the ability to serve data out of MogileFS. Perlbal::Plugin::MogileFS defaults to asynchronous request handling so it handles slow trackers gracefully without blocking the main event loop.

URL paths are converted to ':' delimited MogileFS keys. For example, '/video/10/default.jpg' is converted to 'video:10:default.jpg'. You can change the way keys are hashed by modifying the url_to_key function. Future releases will support URL to Key conversions to be setup in the Perlbal configuration.

Configuration as follows:

  See sample/perlbal.conf
  
  -- Required Configuration Options
  
  MOGILEFS domain = <domain name>
    - Default: none
    - The default MogileFS domain to use for the service.
    
  MOGILEFS trackers = <serv1:6001,serv2:6001>
    - Default: none
    - List of trackers comma delimited.
    
  -- Optional Configuration options
  
  MOGILEFS async = <on/off> 
    - Default: on
    - If to use asynchronous processing to avoid blocking the event loop. Defaults to true.
    
  MOGILEFS etag = <on/off> 
    - Default: on
    - If to generate an ETag with the response. Defaults to true.
    
  MOGILEFS fallback = <on/off>
    - Default: off
    - Should Perlbal try the filesystem docroot if MogileFS key lookup fails.
  
  MOGILEFS noverify = <on/off> 
    - Default: on
    - If to verify mogstored paths on path retrieval. Let Perlbal handle this 
      asynchronously during content delivery time. Defaults to true.
    
  MOGILEFS max_recent = <int> 
    - Default: 100
    - Max amount of fetch records to keep for statistics. Defaults to 100.
    
  MOGILEFS max_miss = <int> 
    - Default: 100
    - Max amount of fetch records to keep for MISS statistics. Defaults to 100.
    
  MOGILEFS retries = <int> 
    - Default: 3
    - Max amount of retries on broken mogilefs tracker socket. Defaults to 3.
    
  MOGILEFS cache_control = <string>
    - Default: off
    - Suggested: max-age=2592000
    - Cache-Control headers appended to responses on HIT for forward caching proxies. 
      It is recommended to have squid or varnish in front.
  
MANAGEMENT COMMANDS

    Telnet into your Perlbal management interface that is normally configured on port 60000.

    mogilefs_stats    Fetch statistics for all mogilefs web services served by this perlbal instance.

    mogilelookup    mogilefs_hits                       14
    mogilelookup    mogilefs_misses                     12
    mogilelookup    mogilefs_requests                   26

    total           mogilefs_hits                       14
    total           mogilefs_misses                     12
    total           mogilefs_requests                   26

    mogilefs_recent   Fetch recent keys tried with MISS/HIT information. See which keys fail.

    mogilelookup MISS  photo:13936:ron-and-jan.tif:640
    mogilelookup MISS  favicon.ico
    mogilelookup MISS  photo:13936:ron-and-jan.tif:640
    mogilelookup HIT   video:100:default.jpg
    mogilelookup HIT   video:799:default.jpg:130

    mogilefs_misses   Fetch recent keys that came back as a MISS. See which keys fail.

    mogilelookup MISS  photo:13936:ron-and-jan.tif:640
    mogilelookup MISS  favicon.ico
    mogilelookup MISS  photo:13936:ron-and-jan.tif:640

- Victor Igumnov