recvmsg(). Workaround is to insert an intervening read
(write) operation. Presumably, LINUX 2.4 is confusing the
data and file descriptor. Lucky Ralf Hildebrandt. Files:
- util/sys_defs.h, global/scache_clnt,c, scache/scache.c.
+ util/sys_defs.h, global/scache_clnt.c, scache/scache.c.
20040723
Bug? Safety? spawn(8) did not reject a user with the -1
- UID value, so the command was running as root. Files:
+ UID value, so the command could run as root. Files:
util/spawn_command.c, src/util/spawn.c.
User interface: parameter smtp_connection_cache_domains
Bugfix: "421 Timeout exceeded" wasn't guarded by setjmp().
Victor Duchovni, Morgan Stanley. File: smtpd/smtpd.c.
+20040729
+
+ Feature: enable SMTP session caching temporarily while a
+ site has a high volume of mail in the active queue.
+ Parameter: smtp_connection_cache_on_demand (default:
+ yes). Files: smtp/smtp_connect.c, *qmgr/qmgr_entry.c,
+ *qmgr/qmgr_queue.c, *qmgr/qmgr_deliver.c.
+
+ Feature: smtp-source -N option to generate unique recipient
+ addresses for (trivial-rewrite) stress testing. Victor
+ Duchovni, Morgan Stanley. File: smtpstone/smtp-source.c.
+
Open problems:
Low: update events.c so that 1-second timer requests do
and change the patchlevel and the release date. Patches are never
issued for snapshot releases.
+Incompatible changes with snapshot Postfix-2.2-20040729
+=======================================================
+
+SMTP session caching is enabled temporarily when a destination has
+a high volume of mail in the active queue. To disable, specify
+"smtp_connection_cache_on_demand = no".
+
+Major changes with snapshot Postfix-2.2-20040729
+================================================
+
+Opportunistic SMTP session caching. When a destination has a high
+volume of mail in the active queue, SMTP session caching is enabled
+temporarily. This is controlled with a new configuration parameter
+"smtp_connection_cache_on_demand" (default: yes).
+
Incompatible changes with snapshot Postfix-2.2-20040723
=======================================================
-Session caching is enabled with smtp_session_cache_destinations,
-and requires "bare" domain names without "[]" or TCP port. This
-eliminates a syntax conflict between host:port and maptype:mapname,
-and simplifies the user interface, at the cost of a minor loss of
-control over what sessions are cached.
+Permanent SMTP session caching is now enabled with the
+smtp_session_cache_destinations parameter. This requires "bare"
+domain names without "[]" or TCP port. The change eliminates a
+syntax conflict between host:port and maptype:mapname, and simplifies
+the user interface, at the cost of a minor loss of control over
+what sessions are cached.
Major changes with snapshot Postfix-2.2-20040721
================================================
Major changes with snapshot Postfix-2.2-20040720
================================================
-Selective SMTP session caching. Instead of disconnecting immediately
-after a mail transaction, the SMTP client can save the open session
-to a session cache daemon, so that any SMTP client process can use
-that session for another mail transaction.
+Selective permanent SMTP session caching. Instead of disconnecting
+immediately after a mail transaction, the SMTP client can save the
+open session to a session cache daemon, so that any SMTP client
+process can use that session for another mail transaction.
This feature introduces the scache (session cache) server, which
is added to your master.cf file when you upgrade Postfix.
<DT><b><a name="smtp_connection_cache_destinations">smtp_connection_cache_destinations</a>
(default: empty)</b></DT><DD>
-<p> The SMTP destinations for which SMTP connection caching is
-enabled. With SMTP connection caching, a connection is not closed
-immediately after completion of a mail transaction. Instead, the
-connection is kept open for up to $<a href="postconf.5.html#smtp_connection_cache_time_limit">smtp_connection_cache_time_limit</a>
+<p> Permanently enable SMTP connection caching for the specified
+destinations. With SMTP connection caching, a connection is not
+closed immediately after completion of a mail transaction. Instead,
+the connection is kept open for up to $<a href="postconf.5.html#smtp_connection_cache_time_limit">smtp_connection_cache_time_limit</a>
seconds. This allows connections to be reused for other deliveries,
and can improve mail delivery performance. </p>
<p></p>
+</DD>
+
+<DT><b><a name="smtp_connection_cache_on_demand">smtp_connection_cache_on_demand</a>
+(default: yes)</b></DT><DD>
+
+<p> Temporarily enable SMTP session caching while a destination
+has a high volume of mail in the <a href="QSHAPE_README.html#active_queue">active queue</a>. With SMTP connection
+caching, a connection is not closed immediately after completion
+of a mail transaction. Instead, the connection is kept open for
+up to $<a href="postconf.5.html#smtp_connection_cache_time_limit">smtp_connection_cache_time_limit</a> seconds. This allows
+connections to be reused for other deliveries, and can improve mail
+delivery performance. </p>
+
+<p> This feature is available in Postfix 2.2 and later. </p>
+
+
</DD>
<DT><b><a name="smtp_connection_cache_reuse_limit">smtp_connection_cache_reuse_limit</a>
<b>-m</b> <i>message</i><b>_</b><i>count</i>
Send the specified number of messages (default: 1).
+ <b>-N</b> Prepend a non-repeating sequence number to each
+ recipient address. This avoids the artificial 100%
+ hit rate in the resolve and rewrite client caches
+ and exercises the trivial-rewrite daemon, better
+ approximating Postfix performance under real-life
+ work-loads.
+
<b>-r</b> <i>recipient</i><b>_</b><i>count</i>
- Send the specified number of recipients per trans-
+ Send the specified number of recipients per trans-
action (default: 1). Recipient names are generated
by prepending a number to the recipient address.
lel (default: 1).
<b>-S</b> <i>subject</i>
- Send mail with the named subject line (default:
+ Send mail with the named subject line (default:
none).
- <b>-t</b> <i>to</i> Use the specified recipient address (default:
+ <b>-t</b> <i>to</i> Use the specified recipient address (default:
<foo@<a href="postconf.5.html#myhostname">myhostname</a>>).
<b>-R</b> <i>interval</i>
Wait for a random period of time 0 <= n <= interval
- between messages. Suspending one thread does not
+ between messages. Suspending one thread does not
affect other delivery threads.
<b>-w</b> <i>interval</i>
thread does not affect other delivery threads.
[<b>inet:</b>]<i>host</i>[:<i>port</i>]
- Connect via TCP to host <i>host</i>, port <i>port</i>. The
+ Connect via TCP to host <i>host</i>, port <i>port</i>. The
default port is <b>smtp</b>.
<b>unix:</b><i>pathname</i>
<a href="smtp-sink.1.html">smtp-sink(1)</a>, SMTP/LMTP message dump
<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
+ The Secure Mailer license must be distributed with this
software.
<b>AUTHOR(S)</b>
After a successful mail transaction, a session may be
saved to the <a href="scache.8.html"><b>scache(8)</a></b> session cache server, so that it
may be used by any SMTP client for a subsequent transac-
- tion. Session caching is disabled by default.
+ tion.
+
+ By default, session caching is enabled temporarily for
+ destinations that have a high volume of mail in the active
+ queue. Session caching can be enabled permanently for spe-
+ cific destinations.
<b>SECURITY</b>
The SMTP client is moderately security-sensitive. It talks
- to SMTP servers and to DNS servers on the network. The
+ to SMTP servers and to DNS servers on the network. The
SMTP client can be run chrooted at fixed low privilege.
<b>STANDARDS</b>
<a href="http://www.faqs.org/rfcs/rfc2920.html">RFC 2920</a> (SMTP Pipelining)
<b>DIAGNOSTICS</b>
- Problems and transactions are logged to <b>syslogd</b>(8). Cor-
- rupted message files are marked so that the queue manager
+ Problems and transactions are logged to <b>syslogd</b>(8). Cor-
+ rupted message files are marked so that the queue manager
can move them to the <b>corrupt</b> queue for further inspection.
- Depending on the setting of the <b><a href="postconf.5.html#notify_classes">notify_classes</a></b> parameter,
- the postmaster is notified of bounces, protocol problems,
+ Depending on the setting of the <b><a href="postconf.5.html#notify_classes">notify_classes</a></b> parameter,
+ the postmaster is notified of bounces, protocol problems,
and of other trouble.
<b>BUGS</b>
SMTP session caching does not work with TLS. The necessary
- support for TLS object passivation and re-activation does
- not exist without closing the session, which defeats the
+ support for TLS object passivation and re-activation does
+ not exist without closing the session, which defeats the
purpose.
- SMTP session caching assumes that SASL credentials are
- valid for all destinations that map onto the same IP
+ SMTP session caching assumes that SASL credentials are
+ valid for all destinations that map onto the same IP
address and TCP port.
<b>CONFIGURATION PARAMETERS</b>
Changes to <b>main.cf</b> are picked up automatically, as <a href="smtp.8.html">smtp(8)</a>
- processes run for only a limited amount of time. Use the
+ processes run for only a limited amount of time. Use the
command "<b>postfix reload</b>" to speed up a change.
- The text below provides only a parameter summary. See
+ The text below provides only a parameter summary. See
<a href="postconf.5.html">postconf(5)</a> for more details including examples.
<b>COMPATIBILITY CONTROLS</b>
Never send EHLO at the start of an SMTP session.
<b><a href="postconf.5.html#smtp_defer_if_no_mx_address_found">smtp_defer_if_no_mx_address_found</a> (no)</b>
- Defer mail delivery when no MX record resolves to
+ Defer mail delivery when no MX record resolves to
an IP address.
<b><a href="postconf.5.html#smtp_line_length_limit">smtp_line_length_limit</a> (990)</b>
that Postfix will send via SMTP.
<b><a href="postconf.5.html#smtp_pix_workaround_delay_time">smtp_pix_workaround_delay_time</a> (10s)</b>
- How long the Postfix SMTP client pauses before
+ How long the Postfix SMTP client pauses before
sending ".<CR><LF>" in order to work around the PIX
firewall "<CR><LF>.<CR><LF>" bug.
<b><a href="postconf.5.html#smtp_pix_workaround_threshold_time">smtp_pix_workaround_threshold_time</a> (500s)</b>
- How long a message must be queued before the PIX
- firewall "<CR><LF>.<CR><LF>" bug workaround is
+ How long a message must be queued before the PIX
+ firewall "<CR><LF>.<CR><LF>" bug workaround is
turned on.
<b><a href="postconf.5.html#smtp_quote_rfc821_envelope">smtp_quote_rfc821_envelope</a> (yes)</b>
- Quote addresses in SMTP MAIL FROM and RCPT TO com-
+ Quote addresses in SMTP MAIL FROM and RCPT TO com-
mands as required by <a href="http://www.faqs.org/rfcs/rfc821.html">RFC 821</a>.
<b><a href="postconf.5.html#smtp_skip_5xx_greeting">smtp_skip_5xx_greeting</a> (yes)</b>
(go away, do not try again later).
<b><a href="postconf.5.html#smtp_skip_quit_response">smtp_skip_quit_response</a> (yes)</b>
- Do not wait for the response to the SMTP QUIT com-
+ Do not wait for the response to the SMTP QUIT com-
mand.
Available in Postfix version 2.0 and earlier:
Available in Postfix version 2.0 and later:
<b><a href="postconf.5.html#disable_mime_output_conversion">disable_mime_output_conversion</a> (no)</b>
- Disable the conversion of 8BITMIME format to 7BIT
+ Disable the conversion of 8BITMIME format to 7BIT
format.
<b><a href="postconf.5.html#mime_boundary_length_limit">mime_boundary_length_limit</a> (2048)</b>
Available in Postfix version 2.1 and later:
<b><a href="postconf.5.html#smtp_send_xforward_command">smtp_send_xforward_command</a> (no)</b>
- Send the non-standard XFORWARD command when the
- Postfix SMTP server EHLO response announces XFOR-
+ Send the non-standard XFORWARD command when the
+ Postfix SMTP server EHLO response announces XFOR-
WARD support.
<b>SASL AUTHENTICATION CONTROLS</b>
<b><a href="postconf.5.html#smtp_sasl_auth_enable">smtp_sasl_auth_enable</a> (no)</b>
- Enable SASL authentication in the Postfix SMTP
+ Enable SASL authentication in the Postfix SMTP
client.
<b><a href="postconf.5.html#smtp_sasl_password_maps">smtp_sasl_password_maps</a> (empty)</b>
- Optional SMTP client lookup tables with one user-
- name:password entry per remote hostname or domain.
+ Optional SMTP client lookup tables with one user-
+ name:password entry per remote hostname or domain.
<b><a href="postconf.5.html#smtp_sasl_security_options">smtp_sasl_security_options</a> (noplaintext, noanonymous)</b>
- What authentication mechanisms the Postfix SMTP
+ What authentication mechanisms the Postfix SMTP
client is allowed to use.
<b>RESOURCE AND RATE CONTROLS</b>
<b><a href="postconf.5.html#smtp_destination_concurrency_limit">smtp_destination_concurrency_limit</a> ($<a href="postconf.5.html#default_destination_concurrency_limit">default_destina</a>-</b>
<b><a href="postconf.5.html#default_destination_concurrency_limit">tion_concurrency_limit</a>)</b>
- The maximal number of parallel deliveries to the
- same destination via the smtp message delivery
+ The maximal number of parallel deliveries to the
+ same destination via the smtp message delivery
transport.
<b><a href="postconf.5.html#smtp_destination_recipient_limit">smtp_destination_recipient_limit</a> ($<a href="postconf.5.html#default_destination_recipient_limit">default_destina</a>-</b>
<b><a href="postconf.5.html#default_destination_recipient_limit">tion_recipient_limit</a>)</b>
- The maximal number of recipients per delivery via
+ The maximal number of recipients per delivery via
the smtp message delivery transport.
<b><a href="postconf.5.html#smtp_connect_timeout">smtp_connect_timeout</a> (30s)</b>
- The SMTP client time limit for completing a TCP
+ The SMTP client time limit for completing a TCP
connection, or zero (use the operating system
built-in time limit).
<b><a href="postconf.5.html#smtp_helo_timeout">smtp_helo_timeout</a> (300s)</b>
- The SMTP client time limit for sending the HELO or
- EHLO command, and for receiving the initial server
+ The SMTP client time limit for sending the HELO or
+ EHLO command, and for receiving the initial server
response.
<b><a href="postconf.5.html#smtp_xforward_timeout">smtp_xforward_timeout</a> (300s)</b>
command, and for receiving the server response.
<b><a href="postconf.5.html#smtp_mail_timeout">smtp_mail_timeout</a> (300s)</b>
- The SMTP client time limit for sending the MAIL
- FROM command, and for receiving the server
+ The SMTP client time limit for sending the MAIL
+ FROM command, and for receiving the server
response.
<b><a href="postconf.5.html#smtp_rcpt_timeout">smtp_rcpt_timeout</a> (300s)</b>
- The SMTP client time limit for sending the SMTP
- RCPT TO command, and for receiving the server
+ The SMTP client time limit for sending the SMTP
+ RCPT TO command, and for receiving the server
response.
<b><a href="postconf.5.html#smtp_data_init_timeout">smtp_data_init_timeout</a> (120s)</b>
- The SMTP client time limit for sending the SMTP
- DATA command, and for receiving the server
+ The SMTP client time limit for sending the SMTP
+ DATA command, and for receiving the server
response.
<b><a href="postconf.5.html#smtp_data_xfer_timeout">smtp_data_xfer_timeout</a> (180s)</b>
- The SMTP client time limit for sending the SMTP
+ The SMTP client time limit for sending the SMTP
message content.
<b><a href="postconf.5.html#smtp_data_done_timeout">smtp_data_done_timeout</a> (600s)</b>
- The SMTP client time limit for sending the SMTP
+ The SMTP client time limit for sending the SMTP
".", and for receiving the server response.
<b><a href="postconf.5.html#smtp_quit_timeout">smtp_quit_timeout</a> (300s)</b>
- The SMTP client time limit for sending the QUIT
+ The SMTP client time limit for sending the QUIT
command, and for receiving the server response.
Available in Postfix version 2.1 and later:
lookups, or zero (no limit).
<b><a href="postconf.5.html#smtp_mx_session_limit">smtp_mx_session_limit</a> (2)</b>
- The maximal number of SMTP sessions per delivery
- request before giving up or delivering to a fall-
+ The maximal number of SMTP sessions per delivery
+ request before giving up or delivering to a fall-
back relay host, or zero (no limit).
<b><a href="postconf.5.html#smtp_rset_timeout">smtp_rset_timeout</a> (20s)</b>
- The SMTP client time limit for sending the RSET
+ The SMTP client time limit for sending the RSET
command, and for receiving the server response.
Available in Postfix version 2.2 and later:
<b><a href="postconf.5.html#smtp_connection_cache_destinations">smtp_connection_cache_destinations</a> (empty)</b>
- The SMTP destinations for which SMTP connection
- caching is enabled.
+ Permanently enable SMTP connection caching for the
+ specified destinations.
+
+ <b>smtp_connection_cache_on_demand (yes)</b>
+ Temporarily enable SMTP session caching while a
+ destination has a high volume of mail in the active
+ queue.
<b><a href="postconf.5.html#smtp_connection_cache_reuse_limit">smtp_connection_cache_reuse_limit</a> (10)</b>
When SMTP session caching is enabled, the number of
- times that an SMTP session is reused before it is
+ times that an SMTP session is reused before it is
closed.
<b><a href="postconf.5.html#smtp_connection_cache_time_limit">smtp_connection_cache_time_limit</a> (2s)</b>
<b>TROUBLE SHOOTING CONTROLS</b>
<b><a href="postconf.5.html#debug_peer_level">debug_peer_level</a> (2)</b>
- The increment in verbose logging level when a
- remote client or server matches a pattern in the
+ The increment in verbose logging level when a
+ remote client or server matches a pattern in the
<a href="postconf.5.html#debug_peer_list">debug_peer_list</a> parameter.
<b><a href="postconf.5.html#debug_peer_list">debug_peer_list</a> (empty)</b>
- Optional list of remote client or server hostname
- or network address patterns that cause the verbose
- logging level to increase by the amount specified
+ Optional list of remote client or server hostname
+ or network address patterns that cause the verbose
+ logging level to increase by the amount specified
in $<a href="postconf.5.html#debug_peer_level">debug_peer_level</a>.
<b><a href="postconf.5.html#error_notice_recipient">error_notice_recipient</a> (postmaster)</b>
- The recipient of postmaster notifications about
- mail delivery problems that are caused by policy,
+ The recipient of postmaster notifications about
+ mail delivery problems that are caused by policy,
resource, software or protocol errors.
<b><a href="postconf.5.html#notify_classes">notify_classes</a> (resource, software)</b>
- The list of error classes that are reported to the
+ The list of error classes that are reported to the
postmaster.
<b>MISCELLANEOUS CONTROLS</b>
<b><a href="postconf.5.html#best_mx_transport">best_mx_transport</a> (empty)</b>
- Where the Postfix SMTP client should deliver mail
+ Where the Postfix SMTP client should deliver mail
when it detects a "mail loops back to myself" error
condition.
<b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
- The default location of the Postfix main.cf and
+ The default location of the Postfix main.cf and
master.cf configuration files.
<b><a href="postconf.5.html#daemon_timeout">daemon_timeout</a> (18000s)</b>
- How much time a Postfix daemon process may take to
- handle a request before it is terminated by a
+ How much time a Postfix daemon process may take to
+ handle a request before it is terminated by a
built-in watchdog timer.
<b><a href="postconf.5.html#disable_dns_lookups">disable_dns_lookups</a> (no)</b>
- Disable DNS lookups in the Postfix SMTP and LMTP
+ Disable DNS lookups in the Postfix SMTP and LMTP
clients.
<b><a href="postconf.5.html#fallback_relay">fallback_relay</a> (empty)</b>
- Optional list of relay hosts for SMTP destinations
+ Optional list of relay hosts for SMTP destinations
that can't be found or that are unreachable.
<b><a href="postconf.5.html#inet_interfaces">inet_interfaces</a> (all)</b>
over an internal communication channel.
<b><a href="postconf.5.html#max_idle">max_idle</a> (100s)</b>
- The maximum amount of time that an idle Postfix
- daemon process waits for the next service request
+ The maximum amount of time that an idle Postfix
+ daemon process waits for the next service request
before exiting.
<b><a href="postconf.5.html#max_use">max_use</a> (100)</b>
- The maximal number of connection requests before a
+ The maximal number of connection requests before a
Postfix daemon process terminates.
<b><a href="postconf.5.html#process_id">process_id</a> (read-only)</b>
- The process ID of a Postfix command or daemon pro-
+ The process ID of a Postfix command or daemon pro-
cess.
<b><a href="postconf.5.html#process_name">process_name</a> (read-only)</b>
- The process name of a Postfix command or daemon
+ The process name of a Postfix command or daemon
process.
<b><a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a> (empty)</b>
The network interface addresses that this mail sys-
- tem receives mail on by way of a proxy or network
+ tem receives mail on by way of a proxy or network
address translation unit.
<b><a href="postconf.5.html#smtp_bind_address">smtp_bind_address</a> (empty)</b>
client should bind to when making a connection.
<b><a href="postconf.5.html#smtp_helo_name">smtp_helo_name</a> ($<a href="postconf.5.html#myhostname">myhostname</a>)</b>
- The hostname to send in the SMTP EHLO or HELO com-
+ The hostname to send in the SMTP EHLO or HELO com-
mand.
<b><a href="postconf.5.html#smtp_host_lookup">smtp_host_lookup</a> (dns)</b>
- What mechanisms when the SMTP client uses to look
+ What mechanisms when the SMTP client uses to look
up a host's IP address.
<b><a href="postconf.5.html#smtp_randomize_addresses">smtp_randomize_addresses</a> (yes)</b>
- Randomize the order of equal-preference MX host
+ Randomize the order of equal-preference MX host
addresses.
<b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
The syslog facility of Postfix logging.
<b><a href="postconf.5.html#syslog_name">syslog_name</a> (postfix)</b>
- The mail system name that is prepended to the pro-
+ The mail system name that is prepended to the pro-
cess name in syslog records, so that "smtpd"
becomes, for example, "postfix/smtpd".
<a href="SASL_README.html">SASL_README</a>, Postfix SASL howto
<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
+ The Secure Mailer license must be distributed with this
software.
<b>AUTHOR(S)</b>
Speak LMTP rather than SMTP.
.IP "\fB-m \fImessage_count\fR"
Send the specified number of messages (default: 1).
+.IP "\fB-N\fR"
+Prepend a non-repeating sequence number to each recipient
+address. This avoids the artificial 100% hit rate in the
+resolve and rewrite client caches and exercises the
+trivial-rewrite daemon, better approximating Postfix
+performance under real-life work-loads.
.IP "\fB-r \fIrecipient_count\fR"
Send the specified number of recipients per transaction (default: 1).
Recipient names are generated by prepending a number to the
Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks).
The default time unit is s (seconds).
.SH smtp_connection_cache_destinations (default: empty)
-The SMTP destinations for which SMTP connection caching is
-enabled. With SMTP connection caching, a connection is not closed
-immediately after completion of a mail transaction. Instead, the
-connection is kept open for up to $smtp_connection_cache_time_limit
+Permanently enable SMTP connection caching for the specified
+destinations. With SMTP connection caching, a connection is not
+closed immediately after completion of a mail transaction. Instead,
+the connection is kept open for up to $smtp_connection_cache_time_limit
seconds. This allows connections to be reused for other deliveries,
and can improve mail delivery performance.
.PP
side. The right-hand side result from "type:table" lookups is
ignored.
.PP
+.SH smtp_connection_cache_on_demand (default: yes)
+Temporarily enable SMTP session caching while a destination
+has a high volume of mail in the active queue. With SMTP connection
+caching, a connection is not closed immediately after completion
+of a mail transaction. Instead, the connection is kept open for
+up to $smtp_connection_cache_time_limit seconds. This allows
+connections to be reused for other deliveries, and can improve mail
+delivery performance.
+.PP
+This feature is available in Postfix 2.2 and later.
.SH smtp_connection_cache_reuse_limit (default: 10)
When SMTP session caching is enabled, the number of times that
an SMTP session is reused before it is closed.
After a successful mail transaction, a session may be saved
to the \fBscache(8)\fR session cache server, so that it
may be used by any SMTP client for a subsequent transaction.
-Session caching is disabled by default.
+
+By default, session caching is enabled temporarily for
+destinations that have a high volume of mail in the active
+queue. Session caching can be enabled permanently for
+specific destinations.
.SH "SECURITY"
.na
.nf
.PP
Available in Postfix version 2.2 and later:
.IP "\fBsmtp_connection_cache_destinations (empty)\fR"
-The SMTP destinations for which SMTP connection caching is
-enabled.
+Permanently enable SMTP connection caching for the specified
+destinations.
+.IP "\fBsmtp_connection_cache_on_demand (yes)\fR"
+Temporarily enable SMTP session caching while a destination
+has a high volume of mail in the active queue.
.IP "\fBsmtp_connection_cache_reuse_limit (10)\fR"
When SMTP session caching is enabled, the number of times that
an SMTP session is reused before it is closed.
%PARAM smtp_connection_cache_destinations
-<p> The SMTP destinations for which SMTP connection caching is
-enabled. With SMTP connection caching, a connection is not closed
-immediately after completion of a mail transaction. Instead, the
-connection is kept open for up to $smtp_connection_cache_time_limit
+<p> Permanently enable SMTP connection caching for the specified
+destinations. With SMTP connection caching, a connection is not
+closed immediately after completion of a mail transaction. Instead,
+the connection is kept open for up to $smtp_connection_cache_time_limit
seconds. This allows connections to be reused for other deliveries,
and can improve mail delivery performance. </p>
<p></p>
+%PARAM smtp_connection_cache_on_demand yes
+
+<p> Temporarily enable SMTP session caching while a destination
+has a high volume of mail in the active queue. With SMTP connection
+caching, a connection is not closed immediately after completion
+of a mail transaction. Instead, the connection is kept open for
+up to $smtp_connection_cache_time_limit seconds. This allows
+connections to be reused for other deliveries, and can improve mail
+delivery performance. </p>
+
+<p> This feature is available in Postfix 2.2 and later. </p>
+
%PARAM smtp_connect_timeout 30s
<p>
#define DEL_REQ_FLAG_VERIFY (1<<8) /* verify recipient, don't deliver */
#define DEL_REQ_FLAG_EXPAND (1<<9) /* verify expansion, don't deliver */
#define DEL_REQ_FLAG_RECORD (1<<10) /* record and deliver */
+#define DEL_REQ_FLAG_SCACHE (1<<11) /* opportunistic caching */
#define DEL_REQ_TRACE_FLAGS_MASK \
(DEL_REQ_FLAG_VERIFY | DEL_REQ_FLAG_EXPAND | DEL_REQ_FLAG_RECORD)
#define DEF_SMTP_CACHE_DEST ""
extern char *var_smtp_cache_dest;
+#define VAR_SMTP_CACHE_DEMAND "smtp_connection_cache_on_demand"
+#define DEF_SMTP_CACHE_DEMAND 1
+extern bool var_smtp_cache_demand;
+
#define VAR_SMTP_CONN_TMOUT "smtp_connect_timeout"
#define DEF_SMTP_CONN_TMOUT "30s"
extern int var_smtp_conn_tmout;
* Patches change the patchlevel and the release date. Snapshots change the
* release date only.
*/
-#define MAIL_RELEASE_DATE "20040723"
+#define MAIL_RELEASE_DATE "20040729"
#define MAIL_VERSION_NUMBER "2.2"
#define VAR_MAIL_VERSION "mail_version"
qmgr_entry.o: ../../include/vstream.h
qmgr_entry.o: ../../include/vbuf.h
qmgr_entry.o: ../../include/mail_params.h
+qmgr_entry.o: ../../include/deliver_request.h
+qmgr_entry.o: ../../include/vstring.h
+qmgr_entry.o: ../../include/recipient_list.h
qmgr_entry.o: qmgr.h
qmgr_entry.o: ../../include/scan_dir.h
qmgr_message.o: qmgr_message.c
};
struct QMGR_QUEUE {
+ int dflags; /* delivery request options */
char *name; /* domain name or address */
char *nexthop; /* domain name */
int todo_refcount; /* queue entries (todo list) */
}
flags = message->tflags
+ | entry->queue->dflags
| (message->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT);
attr_print(stream, ATTR_FLAG_MORE,
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
/* Global library. */
#include <mail_params.h>
+#include <deliver_request.h> /* opportunistic session caching */
/* Application-specific. */
QMGR_ENTRY *qmgr_entry_create(QMGR_QUEUE *queue, QMGR_MESSAGE *message)
{
+ char *myname = "qmgr_entry_create";
QMGR_ENTRY *entry;
/*
QMGR_LIST_APPEND(queue->todo, entry);
queue->todo_refcount++;
+ /*
+ * With opportunistic session caching, the delivery agent must not only
+ * 1) save a session upon completion, but also 2) reuse a cached session
+ * upon the next delivery request. In order to not miss out on 2), we
+ * have to make caching sticky or else we get silly behavior when the
+ * in-memory queue drains. New connections must not be made while cached
+ * connections aren't being reused.
+ */
+ if ((queue->dflags & DEL_REQ_FLAG_SCACHE) == 0
+ && queue->window < queue->todo_refcount + queue->busy_refcount) {
+ if (msg_verbose)
+ msg_info("%s: passing on-demand session caching threshold for %s",
+ myname, queue->name);
+ queue->dflags |= DEL_REQ_FLAG_SCACHE;
+ }
+
/*
* Warn if a destination is falling behind while the active queue
* contains a non-trivial amount of single-recipient email. When a
queue->reason = mystrdup(reason);
event_request_timer(qmgr_queue_unthrottle_wrapper,
(char *) queue, var_min_backoff_time);
+ queue->dflags = 0;
}
}
queue = (QMGR_QUEUE *) mymalloc(sizeof(QMGR_QUEUE));
qmgr_queue_count++;
+ queue->dflags = 0;
queue->name = mystrdup(name);
queue->nexthop = mystrdup(nexthop);
queue->todo_refcount = 0;
qmgr_entry.o: ../../include/vstream.h
qmgr_entry.o: ../../include/vbuf.h
qmgr_entry.o: ../../include/mail_params.h
+qmgr_entry.o: ../../include/deliver_request.h
+qmgr_entry.o: ../../include/vstring.h
+qmgr_entry.o: ../../include/recipient_list.h
qmgr_entry.o: qmgr.h
qmgr_entry.o: ../../include/scan_dir.h
qmgr_job.o: qmgr_job.c
};
struct QMGR_QUEUE {
+ int dflags; /* delivery request options */
char *name; /* domain name or address */
char *nexthop; /* domain name */
int todo_refcount; /* queue entries (todo list) */
}
flags = message->tflags
+ | entry->queue->dflags
| (message->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT);
attr_print(stream, ATTR_FLAG_MORE,
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
/* Global library. */
#include <mail_params.h>
+#include <deliver_request.h> /* opportunistic session caching */
/* Application-specific. */
QMGR_ENTRY *qmgr_entry_create(QMGR_PEER *peer, QMGR_MESSAGE *message)
{
+ char *myname = "qmgr_entry_create";
QMGR_ENTRY *entry;
QMGR_QUEUE *queue = peer->queue;
QMGR_LIST_APPEND(queue->todo, entry, queue_peers);
queue->todo_refcount++;
+ /*
+ * With opportunistic session caching, the delivery agent must not only
+ * 1) save a session upon completion, but also 2) reuse a cached session
+ * upon the next delivery request. In order to not miss out on 2), we
+ * have to make caching sticky or else we get silly behavior when the
+ * in-memory queue drains. New connections must not be made while cached
+ * connections aren't being reused.
+ */
+ if ((queue->dflags & DEL_REQ_FLAG_SCACHE) == 0
+ && queue->window < queue->todo_refcount + queue->busy_refcount) {
+ if (msg_verbose)
+ msg_info("%s: passing on-demand session caching threshold for %s",
+ myname, queue->name);
+ queue->dflags |= DEL_REQ_FLAG_SCACHE;
+ }
+
/*
* Warn if a destination is falling behind while the active queue
* contains a non-trivial amount of single-recipient email. When a
queue->reason = mystrdup(reason);
event_request_timer(qmgr_queue_unthrottle_wrapper,
(char *) queue, var_min_backoff_time);
+ queue->dflags = 0;
}
}
queue = (QMGR_QUEUE *) mymalloc(sizeof(QMGR_QUEUE));
qmgr_queue_count++;
+ queue->dflags = 0;
queue->name = mystrdup(name);
queue->nexthop = mystrdup(nexthop);
queue->todo_refcount = 0;
/* After a successful mail transaction, a session may be saved
/* to the \fBscache(8)\fR session cache server, so that it
/* may be used by any SMTP client for a subsequent transaction.
-/* Session caching is disabled by default.
+/*
+/* By default, session caching is enabled temporarily for
+/* destinations that have a high volume of mail in the active
+/* queue. Session caching can be enabled permanently for
+/* specific destinations.
/* SECURITY
/* .ad
/* .fi
/* .PP
/* Available in Postfix version 2.2 and later:
/* .IP "\fBsmtp_connection_cache_destinations (empty)\fR"
-/* The SMTP destinations for which SMTP connection caching is
-/* enabled.
+/* Permanently enable SMTP connection caching for the specified
+/* destinations.
+/* .IP "\fBsmtp_connection_cache_on_demand (yes)\fR"
+/* Temporarily enable SMTP session caching while a destination
+/* has a high volume of mail in the active queue.
/* .IP "\fBsmtp_connection_cache_reuse_limit (10)\fR"
/* When SMTP session caching is enabled, the number of times that
/* an SMTP session is reused before it is closed.
int var_smtp_reuse_limit;
char *var_smtp_cache_dest;
char *var_scache_service;
+bool var_smtp_cache_demand;
/*
* Global variables. smtp_errno is set by the address lookup routines and by
/*
* Session cache instance.
*/
- if (*var_smtp_cache_dest)
+ if (*var_smtp_cache_dest || var_smtp_cache_demand)
#if 0
smtp_scache = scache_multi_create();
#else
VAR_SMTP_QUOTE_821_ENV, DEF_SMTP_QUOTE_821_ENV, &var_smtp_quote_821_env,
VAR_SMTP_DEFER_MXADDR, DEF_SMTP_DEFER_MXADDR, &var_smtp_defer_mxaddr,
VAR_SMTP_SEND_XFORWARD, DEF_SMTP_SEND_XFORWARD, &var_smtp_send_xforward,
+ VAR_SMTP_CACHE_DEMAND, DEF_SMTP_CACHE_DEMAND, &var_smtp_cache_demand,
0,
};
* :port, because : is already used for maptype:mapname. Because of
* this limitation we use the bare domain without the optional [] or
* non-default TCP port.
+ *
+ * Opportunistic (a.k.a. on-demand) session caching on request by the
+ * queue manager. This is turned temporarily when a destination has a
+ * high volume of mail in the active queue.
*/
if (cpp == sites->argv
- && smtp_cache_dest
- && string_list_match(smtp_cache_dest, domain)) {
+ && ((request->flags & DEL_REQ_FLAG_SCACHE) != 0
+ || (smtp_cache_dest && string_list_match(smtp_cache_dest, domain)))) {
sess_flags |= SMTP_SESS_FLAG_CACHE;
SET_NEXTHOP_STATE(state, lookup_mx, domain, port);
}
/* Speak LMTP rather than SMTP.
/* .IP "\fB-m \fImessage_count\fR"
/* Send the specified number of messages (default: 1).
+/* .IP "\fB-N\fR"
+/* Prepend a non-repeating sequence number to each recipient
+/* address. This avoids the artificial 100% hit rate in the
+/* resolve and rewrite client caches and exercises the
+/* trivial-rewrite daemon, better approximating Postfix
+/* performance under real-life work-loads.
/* .IP "\fB-r \fIrecipient_count\fR"
/* Send the specified number of recipients per transaction (default: 1).
/* Recipient names are generated by prepending a number to the
static int fixed_delay = 0;
static int talk_lmtp = 0;
static char *subject = 0;
+static int number_rcpts = 0;
static void enqueue_connect(SESSION *);
static void start_connect(SESSION *);
if ((except = vstream_setjmp(session->stream)) != 0)
msg_fatal("%s while sending recipient", exception_text(except));
- if (session->rcpt_count > 1)
+ if (session->rcpt_count > 1 || number_rcpts > 0)
command(session->stream, "RCPT TO:<%d%s>",
- session->rcpt_count, recipient);
+ number_rcpts ? number_rcpts++ : session->rcpt_count,
+ recipient);
else
command(session->stream, "RCPT TO:<%s>", recipient);
session->rcpt_count--;
static void usage(char *myname)
{
- msg_fatal("usage: %s -s sess -l msglen -m msgs -c -C count -d -f from -o -t to -r rcptcount -R delay -v -w delay host[:port]", myname);
+ msg_fatal("usage: %s -cdLNov -s sess -l msglen -m msgs -C count -f from -t to -r rcptcount -R delay -w delay host[:port]", myname);
}
/* main - parse JCL and start the machine */
/*
* Parse JCL.
*/
- while ((ch = GETOPT(argc, argv, "cC:df:l:Lm:or:R:s:S:t:vw:")) > 0) {
+ while ((ch = GETOPT(argc, argv, "cC:df:l:Lm:Nor:R:s:S:t:vw:")) > 0) {
switch (ch) {
case 'c':
count++;
if ((message_count = atoi(optarg)) <= 0)
msg_fatal("bad message count: %s", optarg);
break;
+ case 'N':
+ number_rcpts = 1;
+ break;
case 'o':
send_helo_first = 0;
send_headers = 0;