NAME

Apache2::BalanceLogic - Perl extension for mod_proxy_balancer

SYNOPSIS

in httpd.conf

PerlRequire /foo/bar/perl/startup.pl
PerlHeaderParserHandler +Apache2::BalanceLogic
perlSetVar CONFIG_PATH '/foo/bar/perl/Apache2/BalanceLogic/Config/MainConfig.yaml'

and write for mod_proxy_balancer

ProxyPass / balancer://TEST/ stickysession=route_id
<Proxy balancer://TEST/>
  BalancerMember http://your.backend.server_01/ route=1
  BalancerMember http://your.backend.server_02/ route=2
  BalancerMember http://your.backend.server_03/ route=3
  BalancerMember http://your.backend.server_04/ route=4
  BalancerMember http://your.backend.server_05/ route=5
</Proxy>

Applcation Config file ( MainConfig.yaml )

#--- select one Plugin module and config file
Plugin:
  Name: 'DistByURL' 
  Config: '/foo/bar/perl/Apache2/BalanceLogic/Config/PluginConfig/DistByURL.yaml'
  #---
  #Name: 'DistByTime' 
  #Config: '/foo/bar/perl/Apache2/BalanceLogic/Config/PluginConfig/DistByTime.yaml'
  #---
  #Name: 'DistByCookie' 
  #Config: '/foo/bar/perl/Apache2/BalanceLogic/Config/PluginConfig/DistByCookie.yaml'
#--- your server admin ipaddress. it can use __force__ option.
ADMIN_IP:
  - 192.168.1.0/24

DESCRIPTION

This is a simple extention for 'mod_proxy_balancer'. You can put your original Plungin code that distribute the requests among the backend servers by your original algorithm. In other words, this is a "inner cookie trick" for stickysession in mod_proxy_balancer. Let's enjoy!

Plugin

There are 3 sample Plugin modules. ( in Plugin directory )

L<Apache2::BalanceLogic::Plugin::DistByCookie>
  distribute the requests by unique user cookie that maybe generated by usertrac module.
  this is implemented by a simple slurp division code.
L<Apache2::BalanceLogic::Plugin::DistByTime>
  distribute the requests by time number ( hour ). see config file.
L<Apache2::BalanceLogic::Plugin::DistByURL>
  by reqular expression on URL path string.

SEE ALSO

mod_perl

AUTHOR

Takeshi Miki <miki@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2007 Takeshi Miki

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.