Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

load testing

6 views
Skip to first unread message

sunckell

unread,
Nov 28, 2005, 9:19:00 AM11/28/05
to
Hello everyone,

I am running sendmail 3.13 (spamassassin and MIMEDefang) on RHES
3. The hardware configuration is a Dual 3.4 Xeon blade, with about 4
GiGs of Ram. No gig connection just 100M.

I was wondering if there were any "benchmarking" scripts to test
what this configuration can handle. I have two of these servers (in a
round robin DNS configuration) which act as a front end to a MS
Exchange cluster.

What I am looking for is something I can test the amount of email
one of these servers can handle.

The company I work for sends a lot of automated emails to
customers. Every once in a while the development team inquires whether
they can send an additional amount (say 20,000) emails in a weekend. I
have graphs set up that give me the amount we currently send thruough
in a given amount of time. But it wouldbe nice to benchmark the system
under certain sinerios, (like 10,000 10K emails, etc..)

Thanks for any recommendations

Sincerely,
ckell...

David F. Skoll

unread,
Nov 28, 2005, 10:03:55 PM11/28/05
to
sunckell wrote:

> I am running sendmail 3.13 (spamassassin and MIMEDefang) on RHES
> 3. The hardware configuration is a Dual 3.4 Xeon blade, with about 4
> GiGs of Ram. No gig connection just 100M.

> I was wondering if there were any "benchmarking" scripts to test
> what this configuration can handle.

I use a Perl script (appended). Fire it up on one (or a few)
computers, pointing at the device under test. Use it like this:

perl stresstest.pl server sender recipient filename nprocs

where:

- server is the name or IP address of the machine you want to stresstest
- sender is the envelope sender (what goes in MAIL FROM:)
- recipient is the envelope recipient (what goes in RCPT TO:)
- filename is an mbox-style file containing lots of mail messages
- nprocs is how many simultaneous processes you want to fire up.

The script forks "nprocs" children, which each try to send all of the
messages in "filename" one after the other.

Note that the script has poor error handling. It also won't actually
measure the performance for you; you need to extract that from log files
or by some other means. Finally, it won't simulate the "real world" which
is often far nastier than a few well-behaved processes talking to an SMTP
server over a fast LAN. But it's a good first-order approximation of what
it will take to kill your machines. :-)

Regards,

David.

#!/usr/bin/perl -w
# $Id: stresstest.pl,v 1.3 2004/02/20 20:21:16 dfs Exp $
# Blast mail at a server

use Net::SMTP;

# Send mail to a server
sub send_mail ($$$$) {
my($server, $sender, $recipient, $body) = @_;
my $smtp;
$smtp = Net::SMTP->new($server);
if (!defined($smtp)) {
print STDERR "Target refused connection.\n";
return 0;
}
if (!$smtp->ok()) {
$smtp->quit();
return 0;
}
if (!$smtp->mail($sender)) {
$smtp->quit();
return 0;
}
$smtp->to($recipient);
$smtp->data($body);
$smtp->quit();
return 1;
}

# Send all messages in a file to server
sub send_msgs_in_file($$$$) {
my($server, $sender, $recipient, $filename) = @_;
open(IN, "<$filename") or die ("Cannot open $filename: $!");
my($body);

# Skip to "From_" line
while(<IN>) {
last if /^From /;
}

while(!eof(IN)) {
$body = "";
# Read message body
while(<IN>) {
last if /^From /;
$body .= $_;
}
# Got the body; send it until it succeeds
while(1) {
if (send_mail($server, $sender, $recipient, $body)) {
last;
}
}
}
}

sub usage() {
print STDERR <<EOF;
Usage: stresstest.pl server sender recipient filename nprocs

nprocs can range from 1 to 200.
EOF
}

sub fire_proc($$$$) {
my($server, $sender, $recipient, $filename) = @_;
my $pid = fork();
if (!defined($pid)) {
print STDERR "ARGH!! fork failed: $!\n";
return;
}
if ($pid) {
return;
}
send_msgs_in_file($server, $sender, $recipient, $filename);
exit(0);
}

# Do a stress-test on a server
sub stress_test_server ($$$$$) {
my($server, $sender, $recipient, $filename, $nprocs) = @_;
if ($nprocs !~ /^[0-9]+$/) {
usage();
exit(1);
}
if ($nprocs < 1) {
$nprocs = 1;
}
if ($nprocs > 200) {
$nprocs = 200;
}
my($i);
for ($i=0; $i<$nprocs; $i++) {
print STDERR "Firing off process $i\n";
fire_proc($server, $sender, $recipient, $filename);
}

print STDERR "\nWaiting for processes to finish...\n";
while(1) {
$i = wait();
last if ($i == -1);
print STDERR ".";
}
print STDERR "\nAll done.\n";
return 0;
}

my $i;

for ($i=0; $i<5; $i++) {
if (!defined($ARGV[$i]) ||
($ARGV[$i] eq "")) {
usage();
exit(1);
}
}

exit(stress_test_server($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4]));

0 new messages