On Sun, Feb 04, 2007, Peter J. Holzer wrote:
(Also, I'm not sure how expensive fsync() really is if there are lots of
fsync() requests - AFAIK order doesn't have to be maintained, so the OS
can optimize quite a lot there - but does it?).
On a "normal" FS fsync() is very expensive. For sendmail 8 there
is even an option:
# checkpoint queue runs after every N successful deliveries
#O CheckpointInterval=10
to reduce the number of fsync() operations, however, this may cause
repeated deliveries if the MTA crashes between "checkpoints".
You can try some FS tests yourself or you can read about my
performance results at
http://www.sendmail.org/~ca/email/sm-X/design-2005-05-05/main/main.html
(or check the postfix docs/source, there is probably something similar
wrt fsync()).
I've implemented "DRR" in my SMTP server, and I noticed that the
LMTP model, i.e., no explicit "end of mail data" reply, introduces
some problems:
- it requires special code to deal with the fact that a command
doesn't have a reply.
Why doesn't it have a reply? It has one reply for every remaining
recipient, and since there must be at least one (otherwise DATA returns
a 503 reply) there is at least one reply.
That's not a reply for "end of mail data", it is for some RCPT. In
some pseudo code (error handling omitted for simplicity) you could
do this after you received all mail data:
if "DRR" is active: call subroutine to give RCPT status.
commit mail data (all transaction information).
give "end of mail data" reply.
If you don't have a "end of mail data" reply, then the changes are
more "intrusive", which increases the complexity and hence may cause
implementation errors. Let's keep it simple. After I implemented
the original draft and the LMTP model, I came to the conclusion
that this little modification of the LMTP model is the easiest to
implement and has the simplest error handling. Try it yourself in
your favorite MTA :-)
"end of mail data" sounds to me like it is sent before the individual
rcpt replies. But from your reasoning I think you want it after the
individual replies, like the "final response code" in Eric's draft.
Right?
Correct. The "order" is preserved: first RCPTs, then "end of mail
data".