2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-31 14:17:41 +00:00

postfix-2.2-20040721

This commit is contained in:
Wietse Venema
2004-07-21 00:00:00 -05:00
committed by Viktor Dukhovni
parent a360b3aff1
commit 2e9bf3b2a0
17 changed files with 201 additions and 90 deletions

View File

@@ -9567,6 +9567,13 @@ Apologies for any names omitted.
test the effects of collisions in the time or in name space
domains. File: global/scache.c.
20040721
Feature: the session cache server now logs cache hit and
miss statistics every $session_cache_status_update_time
seconds (default: 600s), as well as upon process exit.
File: scache/scache.c.
Open problems:
Low: update events.c so that 1-second timer requests do

View File

@@ -7,6 +7,14 @@ snapshot release). Patches are issued for the official release
and change the patchlevel and the release date. Patches are never
issued for snapshot releases.
Major changes with snapshot Postfix-2.2-20040721
================================================
The session cache manager now logs cache hit and miss statistics
every $session_cache_status_update_time seconds (default: 600s).
It reports the hit and miss rates for lookups by domain, as well
as for lookups by network address.
Incompatible changes with snapshot Postfix-2.2-20040720
=======================================================
@@ -18,7 +26,7 @@ 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
the same session for another mail transaction.
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.
@@ -69,7 +77,8 @@ specified.
Limitations:
- SMTP session caching does not work with TLS (the necessary support
for object passivation and re-activation does not exist).
for object passivation and re-activation does not exist without
closing the connection).
- SMTP session caching assumes that SASL credentials are valid for
all hostnames or domain names that map onto the same IP address

View File

@@ -5038,6 +5038,16 @@ The default time unit is s (seconds).
maintains a limited pool of cached sessions. </p>
</DD>
<DT><b><a name="session_cache_status_update_time">session_cache_status_update_time</a>
(default: 600s)</b></DT><DD>
<p> How frequently the <a href="scache.8.html">scache(8)</a> server logs usage statistics with
session cache hit and miss rates for logical destinations and for
physical endpoints. </p>
</DD>
<DT><b><a name="session_cache_ttl_limit">session_cache_ttl_limit</a>

View File

@@ -98,14 +98,20 @@ SCACHE(8) SCACHE(8)
The maximal time-to-live value that the session
cache server allows.
<b>session_cache_status_update_time (600s)</b>
How frequently the <a href="scache.8.html">scache(8)</a> server logs usage
statistics with session cache hit and miss rates
for logical destinations and for physical end-
points.
<b>MISCELLANEOUS CONTROLS</b>
<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#ipc_timeout">ipc_timeout</a> (3600s)</b>
@@ -113,23 +119,23 @@ SCACHE(8) SCACHE(8)
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#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#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".
@@ -140,7 +146,7 @@ SCACHE(8) SCACHE(8)
syslogd(8), system logging
<b>LICENSE</b>
The Secure Mailer license must be distributed with this
The Secure Mailer license must be distributed with this
software.
<b>HISTORY</b>

View File

@@ -67,19 +67,20 @@ SMTP(8) SMTP(8)
<b>BUGS</b>
SMTP session caching does not work with TLS. The necessary
support for object passivation and re-activation does not
exist.
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>
@@ -93,7 +94,7 @@ SMTP(8) SMTP(8)
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>
@@ -101,17 +102,17 @@ SMTP(8) SMTP(8)
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 ".&lt;CR&gt;&lt;LF&gt;" in order to work around the PIX
firewall "&lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;" 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 "&lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;" bug workaround is
How long a message must be queued before the PIX
firewall "&lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;" 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>
@@ -119,7 +120,7 @@ SMTP(8) SMTP(8)
(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:
@@ -132,7 +133,7 @@ SMTP(8) SMTP(8)
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>
@@ -147,43 +148,43 @@ SMTP(8) SMTP(8)
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>
@@ -191,30 +192,30 @@ SMTP(8) SMTP(8)
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:
@@ -225,23 +226,23 @@ SMTP(8) SMTP(8)
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_domains">smtp_connection_cache_domains</a> (empty)</b>
The SMTP destinations for which SMTP connection
The SMTP destinations for which SMTP connection
caching is enabled.
<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>
@@ -251,46 +252,46 @@ SMTP(8) SMTP(8)
<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>
@@ -302,25 +303,25 @@ SMTP(8) SMTP(8)
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>
@@ -328,22 +329,22 @@ SMTP(8) SMTP(8)
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".
@@ -359,7 +360,7 @@ SMTP(8) SMTP(8)
<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>

View File

@@ -2639,6 +2639,10 @@ The default time unit is s (seconds).
.SH session_cache_service (default: scache)
The name of the scache(8) session cache service. This service
maintains a limited pool of cached sessions.
.SH session_cache_status_update_time (default: 600s)
How frequently the scache(8) server logs usage statistics with
session cache hit and miss rates for logical destinations and for
physical endpoints.
.SH session_cache_ttl_limit (default: 2s)
The maximal time-to-live value that the session cache server
allows. Requests that specify a larger TTL will be stored with the

View File

@@ -100,6 +100,10 @@ postconf(5) for more details including examples.
.IP "\fBsession_cache_ttl_limit (2s)\fR"
The maximal time-to-live value that the session cache server
allows.
.IP "\fBsession_cache_status_update_time (600s)\fR"
How frequently the scache(8) server logs usage statistics with
session cache hit and miss rates for logical destinations and for
physical endpoints.
.SH "MISCELLANEOUS CONTROLS"
.na
.nf

View File

@@ -71,8 +71,8 @@ other trouble.
.ad
.fi
SMTP session caching does not work with TLS. The necessary
support for object passivation and re-activation does not
exist.
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 address and TCP port.

View File

@@ -6928,3 +6928,9 @@ allows. Requests that specify a larger TTL will be stored with the
maximum allowed TTL. The purpose of this additional control is to
protect the infrastructure against careless people. The cache TTL
is already bounded by $max_idle. </p>
%PARAM session_cache_status_update_time 600s
<p> How frequently the scache(8) server logs usage statistics with
session cache hit and miss rates for logical destinations and for
physical endpoints. </p>

View File

@@ -1799,6 +1799,10 @@ extern char *var_scache_service;
#define DEF_SCACHE_TTL_LIM "2s"
extern int var_scache_ttl_lim;
#define VAR_SCACHE_STAT_TIME "session_cache_status_update_time"
#define DEF_SCACHE_STAT_TIME "600s"
extern int var_scache_stat_time;
/*
* Address verification service.
*/

View File

@@ -20,7 +20,7 @@
* Patches change the patchlevel and the release date. Snapshots change the
* release date only.
*/
#define MAIL_RELEASE_DATE "20040720"
#define MAIL_RELEASE_DATE "20040721"
#define MAIL_VERSION_NUMBER "2.2"
#define VAR_MAIL_VERSION "mail_version"

View File

@@ -43,7 +43,7 @@
/* The code maintains two types of association: a) physical
/* endpoint to file descriptor, and b) logical endpoint
/* to physical endpoint. Physical endpoints are stored and
/* look up under their low-level session details such as
/* looked up under their low-level session details such as
/* numerical addresses, while logical endpoints are stored
/* and looked up by the domain name that humans use. One logical
/* endpoint can refer to multiple physical endpoints, one
@@ -153,8 +153,8 @@
* Driver program for cache regression tests. Although all variants are
* relatively simple to verify by hand for single session storage, more
* sophisticated instrumentation is needed to demonstrate that the
* multi-sessin cache manager properly handles collisions in the time domain
* and in the various name space domains.
* multi-session cache manager properly handles collisions in the time
* domain and in all the name space domains.
*/
static SCACHE *scache;
static VSTRING *endp_prop;

View File

@@ -23,9 +23,6 @@
/* Idle time after which the client disconnects.
/* .IP ttl_limit
/* Upper bound on the time that a connection is allowed to persist.
/* .IP endp_ttl
/* How long the session should be cached. When information
/* expires it is purged automatically.
/* DIAGNOSTICS
/* Fatal error: memory allocation problem;
/* panic: internal consistency failure.

View File

@@ -59,8 +59,8 @@
* destination hash table entry.
*
* Likewise, each endpoint has an entry in the endpoint hash table, and each
* endpoint->session binding is kept in a circular list under its hash table
* entry.
* endpoint->session binding is kept in a circular list under its endpoint
* hash table entry.
*
* We do not attempt to limit the number of destination or endpoint entries,
* nor do we attempt to limit the number of sessions. Doing so would require

View File

@@ -84,6 +84,10 @@
/* .IP "\fBsession_cache_ttl_limit (2s)\fR"
/* The maximal time-to-live value that the session cache server
/* allows.
/* .IP "\fBsession_cache_status_update_time (600s)\fR"
/* How frequently the scache(8) server logs usage statistics with
/* session cache hit and miss rates for logical destinations and for
/* physical endpoints.
/* MISCELLANEOUS CONTROLS
/* .ad
/* .fi
@@ -129,6 +133,7 @@
/* System library. */
#include <sys_defs.h>
#include <time.h>
/* Utility library. */
@@ -136,6 +141,7 @@
#include <iostuff.h>
#include <htable.h>
#include <ring.h>
#include <events.h>
/* Global library. */
@@ -154,6 +160,7 @@
* Tunable parameters.
*/
int var_scache_ttl_lim;
int var_scache_stat_time;
/*
* Request parameters.
@@ -169,6 +176,15 @@ static VSTRING *scache_endp_prop;
*/
static SCACHE *scache;
/*
* Statistics.
*/
static int scache_dest_hits;
static int scache_dest_miss;
static int scache_endp_hits;
static int scache_endp_miss;
time_t scache_start_time;
/*
* Silly little macros.
*/
@@ -235,6 +251,7 @@ static void scache_find_endp_service(VSTREAM *client_stream)
ATTR_TYPE_NUM, MAIL_ATTR_STATUS, SCACHE_STAT_FAIL,
ATTR_TYPE_STR, MAIL_ATTR_PROP, "",
ATTR_TYPE_END);
scache_endp_miss++;
return;
} else {
attr_print(client_stream, ATTR_FLAG_NONE,
@@ -246,11 +263,12 @@ static void scache_find_endp_service(VSTREAM *client_stream)
msg_warn("%s: cannot send file descriptor: %m", myname);
if (close(fd) < 0)
msg_warn("close(%d): %m", fd);
scache_endp_hits++;
return;
}
}
/* scache_save_dest_service - protocol to save destiation->endpoint binding */
/* scache_save_dest_service - protocol to save destination->endpoint binding */
static void scache_save_dest_service(VSTREAM *client_stream)
{
@@ -308,6 +326,7 @@ static void scache_find_dest_service(VSTREAM *client_stream)
ATTR_TYPE_STR, MAIL_ATTR_PROP, "",
ATTR_TYPE_STR, MAIL_ATTR_PROP, "",
ATTR_TYPE_END);
scache_dest_miss++;
return;
} else {
attr_print(client_stream, ATTR_FLAG_NONE,
@@ -320,6 +339,7 @@ static void scache_find_dest_service(VSTREAM *client_stream)
msg_warn("%s: cannot send file descriptor: %m", myname);
if (close(fd) < 0)
msg_warn("close(%d): %m", fd);
scache_dest_hits++;
return;
}
}
@@ -364,6 +384,40 @@ static void scache_service(VSTREAM *client_stream, char *unused_service,
vstream_fflush(client_stream);
}
/* scache_status_dump - log and reset cache statistics */
static void scache_status_dump(char *unused_name, char **unused_argv)
{
if (scache_dest_hits || scache_dest_miss
|| scache_endp_hits || scache_endp_miss)
msg_info("statistics: start interval %.15s",
ctime(&scache_start_time) + 4);
if (scache_dest_hits || scache_dest_miss) {
msg_info("statistics: domain lookup hits=%d miss=%d success=%d%%",
scache_dest_hits, scache_dest_miss,
scache_dest_hits * 100
/ (scache_dest_hits + scache_dest_miss));
scache_dest_hits = scache_dest_miss = 0;
}
if (scache_endp_hits || scache_endp_miss) {
msg_info("statistics: address lookup hits=%d miss=%d success=%d%%",
scache_endp_hits, scache_endp_miss,
scache_endp_hits * 100
/ (scache_endp_hits + scache_endp_miss));
scache_endp_hits = scache_endp_miss = 0;
}
scache_start_time = event_time();
}
/* scache_status_update - log and reset cache statistics periodically */
static void scache_status_update(int unused_event, char *context)
{
scache_status_dump((char *) 0, (char **) 0);
event_request_timer(scache_status_update, context, var_scache_stat_time);
}
/* post_jail_init - initialization after privilege drop */
static void post_jail_init(char *unused_name, char **unused_argv)
@@ -388,6 +442,12 @@ static void post_jail_init(char *unused_name, char **unused_argv)
* connected for $idle_limit time units.
*/
var_use_limit = 0;
/*
* Dump and reset cache statistics every so often.
*/
event_request_timer(scache_status_update, (char *) 0, var_scache_stat_time);
scache_start_time = event_time();
}
/* main - pass control to the multi-threaded skeleton */
@@ -396,12 +456,14 @@ int main(int argc, char **argv)
{
static CONFIG_TIME_TABLE time_table[] = {
VAR_SCACHE_TTL_LIM, DEF_SCACHE_TTL_LIM, &var_scache_ttl_lim, 1, 0,
VAR_SCACHE_STAT_TIME, DEF_SCACHE_STAT_TIME, &var_scache_stat_time, 1, 0,
0,
};
multi_server_main(argc, argv, scache_service,
MAIL_SERVER_TIME_TABLE, time_table,
MAIL_SERVER_POST_INIT, post_jail_init,
MAIL_SERVER_EXIT, scache_status_dump,
MAIL_SERVER_SOLITARY,
0);
}

View File

@@ -56,9 +56,9 @@
/* the postmaster is notified of bounces, protocol problems, and of
/* other trouble.
/* BUGS
/* SMTP session caching does not work with TLS. The necessary
/* support for object passivation and re-activation does not
/* exist.
/* 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 purpose.
/*
/* SMTP session caching assumes that SASL credentials are valid for
/* all destinations that map onto the same IP address and TCP port.

View File

@@ -582,6 +582,7 @@ int smtp_connect(SMTP_STATE *state)
if (++addr_count == var_smtp_mxaddr_limit)
next = 0;
if ((sess_flags & SMTP_SESS_FLAG_CACHE) == 0
|| addr->pref == domain_best_pref
|| (session = smtp_reuse_addr(state, addr, port)) == 0)
session = smtp_connect_addr(dest, addr, port, why, sess_flags);
if ((state->session = session) != 0) {