Postfix: smtp-sink: Difference between revisions

From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs)
No edit summary
Onnowpurbo (talk | contribs)
No edit summary
 
Line 1: Line 1:
SMTP-SINK(1)                                                      SMTP-SINK(1)
Postfix sudah menyediakan smtp-sink untuk mentest postfix dalam mengirimkan e-mail dalam jumlah besar.
 
NAME
      smtp-sink - parallelized SMTP/LMTP test server
 
SYNOPSIS
      smtp-sink [options] [inet:][host]:port backlog
 
      smtp-sink [options] unix:pathname backlog
 
DESCRIPTION
      smtp-sink  listens  on  the named host (or address) and port.  It takes
      SMTP messages from the network and throws them away.  The purpose is to
      measure client performance, not protocol compliance.
 
      smtp-sink may also be configured to capture each mail delivery transac-
      tion to file. Since  disk  latencies  are  large  compared  to  network
      delays,  this  mode  of operation can reduce the maximal performance by
      several orders of magnitude.
 
      Connections  can  be  accepted  on  IPv4  or  IPv6  endpoints,  or  on
      UNIX-domain  sockets.  IPv4 and IPv6 are the default.  This program is
      the complement of the smtp-source(1) program.
 
      Note: this is an unsupported test program. No attempt is made to  main-
      tain compatibility between successive versions.
 
      Arguments:
 
      -4    Support  IPv4  only.  This  option has no effect when Postfix is
              built without IPv6 support.
 
      -6    Support IPv6 only. This option is not available when Postfix  is
              built without IPv6 support.
 
      -8    Do not announce 8BITMIME support.
 
      -a    Do not announce SASL authentication support.
 
      -A delay
              Wait  delay  seconds after responding to DATA, then abort prema-
              turely with a 550 reply status.  Do not read further input  from
              the  client;  this  is  an attempt to block the client before it
              sends ".".  Specify a zero delay value to abort immediately.
 
      -b soft-bounce-reply
              Use soft-bounce-reply for soft reject  responses.  The  default
              reply is "450 4.3.0 Error: command failed".
 
      -B hard-bounce-reply
              Use  hard-bounce-reply  for  hard reject responses.  The default
              reply is "500 5.3.0 Error: command failed".
 
      -c    Display running counters that are updated whenever an SMTP  ses-
              sion  ends, a QUIT command is executed, or when "." is received.
 
      -C    Disable XCLIENT support.
 
      -d dump-template
              Dump each mail transaction to a single-message file  whose  name
              is  created  by  expanding the dump-template via strftime(3) and
              appending  a  pseudo-random  hexadecimal  number  (example:
              "%Y%m%d%H/%M."  expands  into "2006081203/05.809a62e3").  If the
              template contains "/" characters, missing directories  are  cre-
              ated automatically.  The message dump format is described below.
 
              Note: this option keeps one capture file  open  for  every  mail
              transaction in progress.
 
      -D dump-template
              Append mail transactions to a multi-message dump file whose name
              is created by expanding the dump-template via  strftime(3).  If
              the  template  contains  "/" characters, missing directories are
              created automatically.  The message  dump  format  is  described
              below.
 
              Note:  this  option  keeps  one capture file open for every mail
              transaction in progress.
 
      -e    Do not announce ESMTP support.
 
      -E    Do not announce ENHANCEDSTATUSCODES support.
 
      -f command,command,...
              Reject the specified commands with  a  hard  (5xx)  error  code.
              This option implies -p.
 
              Examples  of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT,
              VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command  names  by
              white  space  or  commas,  and use quotes to protect white space
              from the shell. Command names are case-insensitive.
 
      -F    Disable XFORWARD support.
 
      -h hostname
              Use hostname in the SMTP greeting, in the HELO response, and  in
              the EHLO response. The default hostname is "smtp-sink".
 
      -H delay
              Delay  the  first  read  operation after receiving DATA (time in
              seconds). Combine with a large test message and a small TCP win-
              dow  size  (see  the  -T  option)  to  test  the  Postfix client
              write_wait() implementation.
 
      -L    Enable LMTP instead of SMTP.
 
      -m count (default: 256)
              An upper bound on the maximal number of simultaneous connections
              that  smtp-sink will handle. This prevents the process from run-
              ning out of  file  descriptors.  Excess  connections  will  stay
              queued in the TCP/IP stack.
 
      -M count
              Terminate after receiving count messages.
 
      -n count
              Terminate after count sessions.
 
      -N    Do not announce support for DSN.
 
      -p    Do not announce support for ESMTP command pipelining.
 
      -P    Change  the server greeting so that it appears to come through a
              CISCO PIX system. Implies -e.
 
      -q command,command,...
              Disconnect (without replying) after receiving one of the  speci-
              fied commands.
 
              Examples  of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT,
              VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command  names  by
              white  space  or  commas,  and use quotes to protect white space
              from the shell. Command names are case-insensitive.
 
      -Q command,command,...
              Send a 421 reply and disconnect after receiving one of the spec-
              ified commands.
 
              Examples  of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT,
              VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command  names  by
              white  space  or  commas,  and use quotes to protect white space
              from the shell. Command names are case-insensitive.
 
      -r command,command,...
              Reject the specified commands with  a  soft  (4xx)  error  code.
              This option implies -p.
 
              Examples  of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT,
              VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command  names  by
              white  space  or  commas,  and use quotes to protect white space
              from the shell. Command names are case-insensitive.
 
      -R root-directory
              Change the process root directory  to  the  specified  location.
              This  option  requires  super-user  privileges.  See also the -u
              option.
 
      -s command,command,...
              Log the named commands to syslogd.
 
              Examples of commands are CONNECT, HELO, EHLO, LHLO, MAIL,  RCPT,
              VRFY,  DATA,  ., RSET, NOOP, and QUIT. Separate command names by
              white space or commas, and use quotes  to  protect  white  space
              from the shell. Command names are case-insensitive.
 
      -S start-string
              An  optional  string  that  is prepended to each message that is
              written to a dump file (see the  dump  file  format  description
              below).  The  following  C  escape  sequences  are supported: \a
              (bell), \b (backspace), \f (formfeed), \n  (newline),  \r  (car-
              riage  return), \t (horizontal tab), \v (vertical tab), \ddd (up
              to three octal digits) and \\ (the backslash character).
 
      -t timeout (default: 100)
              Limit the time for receiving a command or  sending  a  response.
              The time limit is specified in seconds.
 
      -T windowsize
              Override  the default TCP window size. To work around broken TCP
              window scaling implementations, specify a value > 0 and < 65536.
 
      -u username
              Switch  to  the specified user privileges after opening the net-
              work socket and optionally changing the process root  directory.
              This  option  is  required when the process runs with super-user
              privileges. See also the -R option.
 
      -v    Show the SMTP conversations.
 
      -w delay
              Wait delay seconds before responding to a DATA command.
 
      -W command:delay[:odds]
              Wait delay seconds before responding to  command.  If  odds  is
              also  specified  (a  number  between 1-99 inclusive), wait for a
              random multiple of delay. The random multiplier is equal to  the
              number of times the program needs to roll a dice with a range of
              0..99 inclusive, before the dice produces a result greater  than
              or equal to odds.
 
      [inet:][host]:port
              Listen  on  network  interface host (default: any interface) TCP
              port port. Both host and port may be  specified  in  numeric  or
              symbolic form.
 
      unix:pathname
              Listen on the UNIX-domain socket at pathname.
 
      backlog
              The  maximum length the queue of pending connections, as defined
              by the listen(2) system call.
 
DUMP FILE FORMAT
      Each dumped message contains a sequence of text lines, terminated  with
      the newline character. The sequence of information is as follows:
 
      o      The optional string specified with the -S option.
 
      o      The smtp-sink generated headers as documented below.
 
      o      The message header and body as received from the SMTP client.
 
      o      An empty line.
 
      The format of the smtp-sink generated headers is as follows:
 
      X-Client-Addr: text
              The  client  IP address without enclosing []. An IPv6 address is
              prefixed with "ipv6:". This record is always present.
 
      X-Client-Proto: text
              The client protocol: SMTP, ESMTP or LMTP. This record is  always
              present.
 
      X-Helo-Args: text
              The  arguments of the last HELO or EHLO command before this mail
              delivery transaction. This record is present only if the  client
              sent  a  recognizable  HELO or EHLO command before the DATA com-
              mand.
 
      X-Mail-Args: text
              The arguments of the MAIL command that started this mail  deliv-
              ery transaction. This record is present exactly once.
 
      X-Rcpt-Args: text
              The  arguments  of  an  RCPT  command  within this mail delivery
              transaction. There is one record for each RCPT command, and they
              are in the order as sent by the client.
 
      Received: text
              A  message  header  for compatibility with mail processing soft-
              ware. This three-line header marks the end of the  headers  pro-
              vided by smtp-sink, and is formatted as follows:
 
              from helo ([addr])
                    The  HELO or EHLO command argument and client IP address.
                    If the client did not send HELO or EHLO,  the  client  IP
                    address is used instead.
 
              by host (smtp-sink) with proto id random;
                    The  hostname  specified  with  the -h option, the client
                    protocol (see X-Client-Proto above), and the  pseudo-ran-
                    dom portion of the per-message capture file name.
 
              time-stamp
                    A time stamp as defined in RFC 2822.
 
SEE ALSO
      smtp-source(1), SMTP/LMTP message generator
 
LICENSE
      The Secure Mailer license must be distributed with this software.
 
AUTHOR(S)
      Wietse Venema
      IBM T.J. Watson Research
      P.O. Box 704
      Yorktown Heights, NY 10598, USA




==Menjalankan==
==Menjalankan==


Now let's turn our attention to smtp-sink to find out how many messages per second your server can handle from your horrible mass mailing sofware. Postfix has to process each outgoing message even if the server on the other side throws it away (therefore, you can't use this to test the raw performance of your mass mailer unless you connect your mailer directly to smtp-sink).
Pertama-tama sinkronkan waktu di kedua mesin


The following example sets up an SMTP listener on port 25 of localhost:
ntpdate pool.ntp.org


$ ./smtp-sink -c localhost:25 1000


Now you can run your client tests.
Setup SMTP listenser di port 25 (misalnya di localhost)


If you want to get an idea for how much overhead the network imposes and also get a control experiment to see what the theoretical maximum throughput for a mail server, you can make smtp-source and smtp-sink talk to each other. Open two windows. In the first, start up the dummy server like this:


# ./smtp-sink -c localhost:25 1000
smtp-sink -c localhost:25 1000
100


With this in place, start throwing messages at this server with smtp-source in the other window:


$ time ./smtp-source -s 20 -l 5120 -m 100 -c \
Bisa menggunakan postfix untuk mengirim atau dengan smtp-source.
  -f sender@example.com -t recipient@example.com localhost:25
100


real    0m0.239s
time smtp-source -s 20 -l 5120 -m 100 -c 100 -f sender@example.com -t recipient@example.com localhost:25
user    0m0.000s
sys    0m0.040s


This output shows that smtp-sink is much faster at accepting messages than Postfix. It took only 0.239 seconds to accept the messages, which is 18 times faster than the Postfix injection process. Now, wouldn't it be nice if you could throw away all incoming email like this?
real    0m0.239s
user    0m0.000s
sys    0m0.040s





Latest revision as of 10:26, 8 June 2015

Postfix sudah menyediakan smtp-sink untuk mentest postfix dalam mengirimkan e-mail dalam jumlah besar.


Menjalankan

Pertama-tama sinkronkan waktu di kedua mesin

ntpdate pool.ntp.org


Setup SMTP listenser di port 25 (misalnya di localhost)


smtp-sink -c localhost:25 1000


Bisa menggunakan postfix untuk mengirim atau dengan smtp-source.

time smtp-source -s 20 -l 5120 -m 100 -c 100 -f sender@example.com -t recipient@example.com localhost:25
real    0m0.239s
user    0m0.000s
sys     0m0.040s


Referensi