Commit 86f171ac authored by Paul Querna's avatar Paul Querna
Browse files

Add two new modules to handle load balancing across multiple apache servers

within the same datacenter.

mod_heartbeat generates multicast status messages with the current number of 
clients connected, but the formated can easily be extended to include other 
things.

mod_heartmonitor collects these messages into a static file, which then can be 
used for other modules to make load balancing decisions on.

This module was originally written at Joost by Sander Striker, Justin 
Erenkrantz, and myself.  We have been given permission by our employer to 
contribute this module.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@721952 13f79535-47bb-0310-9956-ffa450edef68
parent 4cab7469
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,12 @@
Changes with Apache 2.3.0
[ When backported to 2.2.x, remove entry from this file ]

  *) mod_heartmonitor: New module to collect heartbeats, and write out a file
     so that other modules can load balance traffic as needed. [Paul Querna]

  *) mod_heartbeat: New module to genarate multicast heartbeats to konw if a 
     server is online. [Paul Querna]

  *) core: Error responses set by filters were being coerced into 500 errors,
     sometimes appended to the original error response. Log entry of:
     'Handler for (null) returned invalid result code -3' 
+3 −0
Original line number Diff line number Diff line
@@ -13,6 +13,9 @@ cache/
database/
  The apache DBD framework manages connections to SQL backends efficiently.

cluster/
  Modules for working with multiple servers.

dav/
  This directory houses modules that implement WebDAV functionality.

+3 −0
Original line number Diff line number Diff line
# a modules Makefile has no explicit targets -- they will be defined by
# whatever modules are enabled. just grab special.mk to deal with this.
include $(top_srcdir)/build/special.mk
+33 −0
Original line number Diff line number Diff line
mod_heartbeat

Broadcasts the current Apache Connection status over multicast.

Example Configuration:
  HeartbeatAddress 239.0.0.1:27999

Dependencies:
  mod_status must be either a static module, or if a dynamic module, it must be 
  loaded before mod_heartbeat.


Consuming:
  Every 1 second, this module generates a single multicast UDP packet,
  containing the number of busy and idle workers.
  
  The packet is a simple ASCII format, similiar to GET query parameters in UDP.
  
  An Example packet:
    v=1&ready=75&busy=0

  Consumers should handle new variables besides busy and ready, separated by '&'
  being added in the future.
  
Misc:
  The interval of 1 seconds is controlled by the HEARTBEAT_INTERVAL
  compile time define.  This is not currently tunable at run time. To make this
  module send the status packet more often, you must add to the CFLAGS used to
  compile the module to include:
    -DHEARTBEAT_INTERVAL=3
  Would cause the broadcasts to be sent every 3 seconds.

+30 −0
Original line number Diff line number Diff line
mod_heartmonitor

Collects the Apache Connection status data over multicast.

Example Configuration:
  # First parameter is the interface to listen on
  HeartbeatListen 239.0.0.1:27999
  # Absolute path, or relative path to ServerRoot
  HeartbeatStorage logs/hb.dat

Dependencies:
  Due to a bug in APR's apr_socket_recvfrom, version 1.2.12 or newer must be
  used:
    <http://svn.apache.org/viewvc?view=rev&revision=467600>

Consuming:
  This module atomically writes to the configured path, a list of servers, 
  along with metadata about them.
  
  Included data about each server:
    - IP Address
    - Busy Slots
    - Open Slots
    - Last Seen

  Every 5 seconds, this file will be updated with the current status of the 
  cluster.

  
Loading