I needed a simple way to send lots of messages (for testing the trunk
code) so I patched swaks:
http://jetmore.org/john/code/#swaks
to send multiple identical messages at once (via fork). Please see the
attached patch. Remember if you are doing this, you will need to up the
--limit-connections
and --max-from-ip
options when running qpsmtpd. I was able to get the pollserver from
trunk to accept 100 simultaneous messages without breaking a sweat
(although it took > 30 seconds so the last swaks session actually timed
out and got hit by check_earlytalker). The nice thing was the load
never went above 0.55 (700MHz Celeron)!
John
--- bin/swaks.orig 2005-12-30 14:02:23.994594928 -0500
+++ bin/swaks 2005-12-30 14:17:25.040035608 -0500
@@ -68,7 +68,8 @@
'stl|show-time-lapse:s' => \$O{show_time_lapse}, # print lapse for send/recv
'ndf|no-data-fixup' => \$O{no_data_fixup}, # don't touch the data
'pipe:s' => \$O{pipe_cmd}, # command to communicate with
- 'socket:s' => \$O{socket}, # unix doain socket to talk to
+ 'socket:s' => \$O{socket}, # unix domain socket to talk to
+ 'fork:i' => \$O{fork}, # send many messages in parallel
'dump' => \$O{dump_args} # build options and dump
) || exit(1);
@@ -118,6 +119,22 @@
# set info in global hash %G::link
# XXX instead of passing raw data, have processs_opts create a link_data
# XXX hash that we can pass verbatim here
+
+if ( defined $O{fork} && $O{fork} > 0 ) {
+ $SIG{CHLD} = 'IGNORE';
+ for ( my $i = 0; $i < $O{fork}; $i++ ) {
+ if ( my $pid = fork ) {
+ print STDERR "Spawned: $i\n";
+ }
+ else {
+ goto SEND;
+ }
+ }
+ exit(0);
+}
+
+SEND:
+
open_link();
sendmail($opts->{from}, $opts->{to}, $opts->{helo}, $opts->{data},