POP3 Stress ReliefHow to relieve Mail Server stress. Many organisations are finding that their Mail Servers are having to work unduly hard, not due to the amount of mail, but because by default most mail clients check for mail too often! There are a couple of approaches to resolve this situation. The first would be to deploy more Mail Servers, but this is obviously not the most efficient way to manage the problem. A second method would be to configure all the clients to check mail less often, this would be difficult to do initially and obviously users are liable to reconfigure their mail clients. There is another way, one that does not require the deployment of more Mail Servers, or trying to manage hundreds (possibly thousands) of clients. This method is to utilise the intelligent traffic management capabilities of Zeus’ ZXTM. Using ZXTM. What we can do with ZXTM is for it to front the Mail Servers and to make a decision whether a POP3 request should go through to the server, or whether ZXTM should politely turn the client away. Using TrafficScript we can have the ZXTM check each client’s request and gather information on these requests. Then using this information (for example is this the Xth request or is it 10 minutes since the last time the client was allowed through to the server?), the ZXTM can either pass the client through to the Mail Server, or alternatively pose as the Mail Server and tell the client there is no mail to collect and send them away.
The TrafficScript. Rule One is to catch the initial request from the client, that contains the user name. Rule Two is to deal with all other requests. You also need to set a serverfirst_banner in the POP3 Virtual Server. # POP stress relief Rule One
#
# Free memory if we've used too much
if( data.getMemoryUsage() > 102400 ) {
data.reset();
}
# Reset counters if day has changed
$day = data.get( "day" );
$dayofweek = sys.time.weekday();
if( $day != $dayofweek ){
data.reset();
data.set( "day", $dayofweek );
}
# Grab the clients user name from the connection,
# then use this name to get the stored "count" value
# and calculate the present "count" value
#
$req = string.trim( request.endswith( "\n" ));
if( string.regexmatch( $req, "USER (.*)")) {
$count = data.get( $1 );
$time = sys.time();
$count = $time - $count;
# If it is more than 10 minutes since the
# client's last connection, then set the
# "count" data to the present time
#
if( $count >600 ){
data.set( $1, $time );
# Now set the connection data to show that this is
# a client we are sending to the mail server. Set the
# request to send to the back end server, then use this
# server
#
connection.data.set( "state", "connecting" );
request.set( "USER " . $1 . "\r\n" );
pool.use( "POP server" );
# If the count was not 10 minutes, set the connection
# state to blank
#
}else
connection.data.set( "state", "blank" );
request.sendresponse( "+OK\r\n" );
}# POP stress relief Rule Two
#
# check the state of this connection, if connecting
# then continue sending requests through to the mail
# server
#
$state = connection.data.get( "state" );
if( $state == "connecting" ) {
pool.use( "POP server" );
}
# If the state of the connection is "blank" then let the
# ZXTM produce the responses
#
$data = request.get();
if( string.contains( $data, "STAT" ) ){
request.sendResponse( "+OK 0 0\r\n" );
}else if( string.contains( $data, "QUIT" )){
connection.close( "+OK\r\n" );
} else{ request.sendresponse( "+OK\r\n" );
}
Nick Bond
[Zeus Systems Engineering] 09 June 2006
Comments:This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Comment from:
Michael Wells [Visitor]
· http://www.thirdlight.com
Since the serverfirst_banner banner is not an option for the POP3 protocol (or generic TCP protocols) this example cannot be put into use in ZXTM!
Comment from:
Nick Bond [Visitor]
From v4.1 of the ZXTM code, serverfirst_banner is an option for these protocols.
Comment from:
Phill Penpraze [Visitor]
That's a great way to send away those pesky POP3 clients away!
|
Recent Articles
Other Resources
|



