New pipelining service extension Internet Draft

Ned Freed <NED@sigurd.innosoft.com> Sun, 27 March 1994 00:10 UTC

Received: from ietf.nri.reston.va.us by IETF.CNRI.Reston.VA.US id aa04254; 26 Mar 94 19:10 EST
Received: from CNRI.RESTON.VA.US by IETF.CNRI.Reston.VA.US id aa04250; 26 Mar 94 19:09 EST
Received: from dimacs.rutgers.edu by CNRI.Reston.VA.US id aa13710; 26 Mar 94 19:09 EST
Received: by dimacs.rutgers.edu (5.59/SMI4.0/RU1.5/3.08) id AA11919; Sat, 26 Mar 94 18:13:07 EST
Received: from SIGURD.INNOSOFT.COM by dimacs.rutgers.edu (5.59/SMI4.0/RU1.5/3.08) id AA11915; Sat, 26 Mar 94 18:13:03 EST
Received: from SIGURD.INNOSOFT.COM by SIGURD.INNOSOFT.COM (PMDF V4.4-0 #1234) id <01HAFFHGQF7495MSFY@SIGURD.INNOSOFT.COM>; Sat, 26 Mar 1994 15:12:31 PST
Date: Sat, 26 Mar 1994 15:12:04 -0800
Sender: ietf-archive-request@IETF.CNRI.Reston.VA.US
From: Ned Freed <NED@sigurd.innosoft.com>
Subject: New pipelining service extension Internet Draft
To: Internet-Drafts@CNRI.Reston.VA.US, ietf-smtp@dimacs.rutgers.edu
Cc: klensin@infoods.mit.edu, moore@cs.utk.edu, ned@innosoft.com
Message-Id: <01HAFKQPATJ495MSFY@SIGURD.INNOSOFT.COM>
Mime-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="Boundary (ID doeMWaqHULyqHJhZLsQWCg)"

The following is an updated version of the pipelining SMTP service extension
Internet Draft.

					Ned






Network Working Group                   John Klensin, WG Chair
Internet Draft                                       Ned Freed
<draft-ietf-smtpex-pipeline-00.txt>

                    SMTP Service Extension
                    for Command Pipelining

                        March 26, 1994


                     Status of this Memo

This document is an Internet-Draft.  Internet-Drafts are
working documents of the Internet Engineering Task Force
(IETF), its areas, and its working groups. Note that other
groups may also distribute working documents as Internet-
Drafts.

Internet-Drafts are draft documents valid for a maximum of six
months. Internet-Drafts may be updated, replaced, or obsoleted
by other documents at any time.  It is not appropriate to use
Internet-Drafts as reference material or to cite them other
than as a "working draft" or "work in progress".

To learn the current status of any Internet-Draft, please
check the 1id-abstracts.txt listing contained in the
Internet-Drafts Shadow Directories on ds.internic.net,
nic.nordu.net, ftp.isi.edu, or munnari.oz.au.


1.  Abstract

This memo defines an extension to the SMTP service whereby a
server can indicate the extent of its ability to accept
multiple commands in a single TCP send operation. Using a
single TCP send operation for multiple commands can improve
SMTP performance significantly.


2.  Introduction

Although SMTP is widely and robustly deployed, certain
extensions may nevertheless prove useful. In particular, many
parts of the Internet make use of high latency network links.
SMTP's intrinsic one command-one response structure is











Internet Draft         SMTP Pipelining              March 1994


significantly penalized by high latency links, often to the
point where the factors contributing to overall connection
time are dominated by the time spent waiting for responses to
individual commands (turnaround time).

In the best of all worlds it would be possible to simply
deploy SMTP client software that makes use of command
pipelining: batching up multiple commands into single TCP send
operations. Unfortunately, the original SMTP specification [1]
did not explicitly state that SMTP servers must support this.
As a result a non-trivial number of Internet SMTP servers
cannot adequately handle command pipelining. Flaws known to
exist in deployed servers include:

(1)  Connection handoff and buffer flushes in the middle of
     the SMTP dialogue.  Creation of server processes for
     incoming SMTP connections is a useful, obvious, and
     harmless implementation technique. However, some SMTP
     servers defer process forking and connection handoff
     until some intermediate point in the SMTP dialogue. When
     this is done material read from the TCP connection and
     kept in process buffers can be lost.

(2)  Flushing the TCP input buffer when an SMTP command fails.
     SMTP commands often fail but there is no reason to flush
     the TCP input buffer when this happens.  Nevertheless,
     some SMTP servers do this.

(3)  Improper processing and promulgation of SMTP command
     failures. For example, some SMTP servers will refuse to
     accept a DATA command if the last RCPT TO command fails,
     paying no attention to the success or failure of prior
     RCPT TO command results. Other servers will accept a DATA
     command even when all previous RCPT TO commands have
     failed. Although it is possible to accomodate this sort
     of behavior in a client that employs command pipelining,
     it does complicate the construction of the client
     unnecessarily.

This memo uses the mechanism described in [2] to define an
extension to the SMTP service whereby an SMTP server can
declare that it is capable of handling pipelined commands. The
SMTP client can then check for this declaration and use
pipelining only when the server declares itself capable of
handling it.





                    Expires September 1994            [Page 2]





Internet Draft         SMTP Pipelining              March 1994


3.  Framework for the Command Pipelining Extension

The Command Pipelining extension is defined as follows:

(1)  the name of the SMTP service extension is Pipelining;

(2)  the EHLO keyword value associated with the extension is
     PIPELINING;

(3)  no parameter is used with the PIPELINING EHLO keyword;

(4)  no additional parameters are added to either the MAIL
     FROM or RCPT TO commands.

(5)  no additional SMTP verbs are defined by this extension;
     and,

(6)  the next section specifies how support for the extension
     affects the behavior of a server and client SMTP.


4.  The Pipelining Service Extension

When a client SMTP wishes to employ command pipelining, it
first issues the EHLO command to the server SMTP. If the
server SMTP responds with code 250 to the EHLO command, and
the response includes the EHLO keyword value PIPELINING, then
the server SMTP has indicated that it can accomodate SMTP
command pipelining.


4.1.  Client use of pipelining

Once the client SMTP has confirmed that support exists for the
pipelining extension, the client SMTP may then elect to
transmit groups of SMTP commands in batches without waiting
for a response to each individual command. In particular, the
commands RSET, MAIL FROM, SEND FROM, SOML FROM, SAML FROM, and
RCPT TO can all appear anywhere in a pipelined command group.
The EHLO, DATA, VRFY, EXPN, TURN, QUIT, and NOOP commands can
only appear as the last command in a group since their success
or failure produces a change of state which the client SMTP
must accomodate. (NOOP is included in this group so it can be
used as a synchronization point.)






                    Expires September 1994            [Page 3]





Internet Draft         SMTP Pipelining              March 1994


Additional commands added by other SMTP extensions may only
appear as the last command in a group unless otherwise
specified by the extensions that define the commands.

Client SMTP implementations that employ pipelining MUST check
all statuses associated with each command in the group. For
example, if none of the RCPT TO recipient addresses were
accepted the client must then check the response to the DATA
command. If the DATA command was properly rejected the client
SMTP can just issue RSET, but if the DATA command was accepted
the client SMTP should send a single dot.

Client SMTP implementation MAY elect to operate in a
nonblocking fashion, processing server responses immediately
upon receipt. If nonblocking operation is not supported,
however, client SMTP implementations MUST also check the TCP
window size and make sure that each group of commands fits
entirely within the window. The window size is usually, but
not always, 4K octets. Failure to perform this check can lead
to deadlock conditions.


4.2.  Server support of pipelining

A server SMTP implementation that offers the pipelining
extension:

(1)  MUST NOT flush or otherwise lose the contents of the TCP
     input buffer under any circumstances whatsoever.

(2)  SHOULD issue a positive response to the DATA command if
     and only if one or more valid RCPT TO addresses have been
     previously received.

(3)  MUST NOT, after issuing a positive response to a DATA
     command with no valid recipients and subsequently
     receiving an empty message, send any message whatsoever
     to anyone.

(4)  SHOULD elect to store command responses to RSET, MAIL
     FROM, SEND FROM, SOML FROM, SAML FROM, and RCPT TO in an
     internal buffer so they can sent as a unit.

(5)  MUST NOT buffer responses to EHLO, DATA, VRFY, EXPN,
     TURN, QUIT, and NOOP.





                    Expires September 1994            [Page 4]





Internet Draft         SMTP Pipelining              March 1994


(6)  MUST NOT buffer responses to unrecognized commands.

(7)  MUST send all pending responses immediately whenever the
     local TCP input buffer is emptied.

(8)  MUST NOT make assumptions about commands that are yet to
     be received.

The overriding intent of these server requirements is to make
it as easy as possible for servers to conform to these
pipelining extensions.

5.  Examples

Consider the following SMTP dialogue that does not use
pipelining:

S: <wait for open connection>
C: <open connection to server>
S: 220 innosoft.com SMTP service ready
C: HELO dbc.mtview.ca.us
S: 250 innosoft.com
C: MAIL FROM:<mrose@dbc.mtview.ca.us>
S: 250 sender <mrose@dbc.mtview.ca.us> OK
C: RCPT TO:<ned@innosoft.com>
S: 250 recipient <ned@innosoft.com> OK
C: RCPT TO:<dan@innosoft.com>
S: 250 recipient <dan@innosoft.com> OK
C: RCPT TO:<kvc@innosoft.com>
S: 250 recipient <kvc@innosoft.com> OK
C: DATA
S: 354 enter mail, end with line containing only "."
 ...
C: .
S: 250 message sent
C: QUIT
S: 250 goodbye

The client waits for a server response a total of 9 times in
this simple example. But if pipelining is employed the
following dialogue is possible:

S: <wait for open connection>
C: <open connection to server>
S: 220 innosoft.com SMTP service ready





                    Expires September 1994            [Page 5]





Internet Draft         SMTP Pipelining              March 1994


C: EHLO dbc.mtview.ca.us
S: 250-innosoft.com
S: 250 PIPELINING
C: MAIL FROM:<mrose@dbc.mtview.ca.us>
C: RCPT TO:<ned@innosoft.com>
C: RCPT TO:<dan@innosoft.com>
C: RCPT TO:<kvc@innosoft.com>
C: DATA
S: 250 sender <mrose@dbc.mtview.ca.us> OK
S: 250 recipient <ned@innosoft.com> OK
S: 250 recipient <dan@innosoft.com> OK
S: 250 recipient <kvc@innosoft.com> OK
S: 354 enter mail, end with line containing only "."
 ...
C: .
C: QUIT
S: 250 message sent
S: 250 goodbye

The total number of turnarounds has been reduced from 9 to 4.

The next example illustrates one possible form of behavior
when pipelining is used and all recipients are rejected:

S: <wait for open connection>
C: <open connection to server>
S: 220 innosoft.com SMTP service ready
C: EHLO dbc.mtview.ca.us
S: 250-innosoft.com
S: 250 PIPELINING
C: MAIL FROM:<mrose@dbc.mtview.ca.us>
C: RCPT TO:<nsb@thumper.bellcore.com>
C: RCPT TO:<galvin@tis.com>
C: DATA
S: 250 sender <mrose@dbc.mtview.ca.us> OK
S: 550 remote to <nsb@thumper.bellore.com> not allowed
S: 550 remote to <galvin@tis.com> not allowed
S: 550 no valid recipients given
C: QUIT
S: 250 goodbye

The client SMTP waits for the server 4 times here as well. If
the server SMTP does not check for at least one valid
recipient prior to accepting the DATA command, the following
dialogue would result:





                    Expires September 1994            [Page 6]





Internet Draft         SMTP Pipelining              March 1994


S: <wait for open connection>
C: <open connection to server>
S: 220 innosoft.com SMTP service ready
C: EHLO dbc.mtview.ca.us
S: 250-innosoft.com
S: 250 PIPELINING
C: MAIL FROM:<mrose@dbc.mtview.ca.us>
C: RCPT TO:<nsb@thumper.bellcore.com>
C: RCPT TO:<galvin@tis.com>
C: DATA
S: 250 sender <mrose@dbc.mtview.ca.us> OK
S: 550 remote to <nsb@thumper.bellore.com> not allowed
S: 550 remote to <galvin@tis.com> not allowed
S: 354 enter mail, end with line containing only "."
 ...
C: .
C: QUIT
S: 550 no valid recipients
S: 250 goodbye

6.  Security Considerations

This RFC does not discuss security issues and is not believed
to raise any security issues not endemic in electronic mail
and present in fully conforming implementations of [1].


7.  Acknowledgements

This document is based on the SMTP service extension model
presented in RFC 1425. Marshall Rose's description of SMTP
command pipelining in his book "The Internet Message" also
served as a source of inspiration for this extension.


8.  References

[1]  J.B. Postel.  Simple Mail Transfer Protocol. Request for
     Comments 821, (August, 1982).

[2]  J.C. Klensin, N. Freed, M.T. Rose, E.A. Stefferud,
     D.H. Crocker.  SMTP Service Extensions. Internet-draft,
     (March, 1994).







                    Expires September 1994            [Page 7]





Internet Draft         SMTP Pipelining              March 1994


9.  Chair and Author Addresses

John Klensin, WG Chair
United Nations University
P.O. Box 500, Charles Street Station
Boston, MA 02114-0500
USA
 tel: +1 617 227 8747           fax: +1 617 491 6266
 email: klensin@infoods.unu.edu

Ned Freed
Innosoft International, Inc.
1050 East Garvey Avenue South
West Covina, CA 91790
USA
 tel: +1 818 919 3600           fax: +1 818 919 3614
 email: ned@innosoft.com

































                    Expires September 1994            [Page 8]