Paul J Stevens пишет:
I looked at the code for smtp-sink.c.

It does the same as dbmail-lmtp: read one char at a time. Only
difference is that it uses getc(2) rather than read(2).
But it looks like it works with 4k blocks. It's 4096 times faster :)

read(5, "AiAC0AIgA/AD8AIgBABC4AIgBfAC0AOw"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "MDEIAAEx\r\nADEAMwA2ABAEMAAwADIAFA"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "ICAgICANAAA4NjAwMjExMTAzMjM5CgAA"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "EwMzI0MQgAADAwMTMyLTE1DQAAODYw\r\n"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "MDcu\r\nMTk4NiAMAAAgMTEuMTAuMTk4Ni"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "AAYDAACYLwAAegMAAAswAADtAwAAmzAA"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "hQUGhvdG9GaXgAQkFTSUMASFBS\r\nUE9G"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "\r\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "AAAAEwEAAA8AAAATAQAAAAAAAAAAAAAA"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "wAAAAAACAAAMCyQCEA6RQB\r\nQQsAfgIK"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "gABgAfAAAa4kA2AIBPAkE2AABM7UAcAA"..., 4096) = 4096
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 0) = 1
poll([{fd=5, events=POLLIN, revents=POLLIN}], 1, 100000) = 1
read(5, "AAD9AAoAKgACACMADAAAAP0ACgAqAAMA"..., 4096) = 4096




Artem Bokhan wrote:
Paul J Stevens пишет:
If you can think of, or direct me to a better approach for doing async
network reads in lmtp, please do share. I'm sure it's possible. But I
havent really dug into this yet.


Although I'm not sure this can help you, the smallest example of fast
and simple lmtp server it's possible to find with postfix,
/src/smtpstone/smtp-sink.c


NAME
smtp-sink - multi-threaded 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.

_______________________________________________
DBmail mailing list
DBmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail




_______________________________________________
DBmail mailing list
DBmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to