Appendix A: Server Agent Probes
Server Agents and Load Balancing Policies
Server agents work with all load balancing policies (see "Equalizer's Load Balancing Policies" on page 127), except
for
-- which simply ignores any agent response for all servers in the cluster. All other policies use the
round robin
integer returned by the agent as one factor in determining the server to which a new request is sent.
The
policy gives primary importance to the value returned by a server agent over other load balancing
server agent
factors (server weight, number of current connections, etc.).
Server Agents and Server 'Down' Conditions
Note that there is no return code for 'server down' in the table above. This is because Equalizer normally relies on
the other health check probes (ICMP, TCP, and ACV probes) to determine whether the server is up. So, even if the
server agent responds with "-1" or "-2", this by itself will not cause Equalizer to mark the server down.
To change this default behavior, enable the global
Parameters" on page 85). When this global flag is enabled and server agents are enabled for a cluster, then Equalizer
will mark a server in the cluster 'down' if either of the following are true:
•
Equalizer does not get a response from the server agent running on the server before the probe timeout
elapses
•
Equalizer receives either a '-1' or '-2' response from the server agent running on a server
Sample Server Agent in Perl
You can write custom agents as shell scripts, or in Java, Perl, C, or other languages. The code below is a simple
server agent example written in Perl. This code assumes that an integer response value is supplied on the command
line, and returns that value when a connection is made on port 1510 (configurable via the
sample agent is intended for testing purposes only. In a real deployment, the server agent would determine the
response value to return by polling system resources, or some other real-time method.
#!/usr/bin/perl -w
# serveragent.pl
#--------------------
#(c) Copyright 2008 Coyote Point Systems, Inc.
use strict;
use Socket;
# use port 1510 as default
my $port = 1510;
my $proto = getprotobyname('tcp');
# take the server agent response value from the command line
my $response = shift;
# response has to be a valid server agent response
$response==-1 or ($response > 0 and $response<101)
or die "Response must be between -1 and 100";
# create a socket and set the options, set up listen port
socket(SERVER, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1) or die "setsock: $!";
my $paddr = sockaddr_in($port, INADDR_ANY);
# bind to the port, then listen on it
256
flag (see "Modifying Global
require agent response
Equalizer Installation and Administration Guide
variable). This
$port
Need help?
Do you have a question about the E350GX and is the answer not in the manual?
Questions and answers