From: Wietse Venema Date: Wed, 21 Jul 2004 05:00:00 +0000 (-0500) Subject: postfix-2.2-20040721 X-Git-Tag: v2.2.0-RC1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e9bf3b2a09be0ebff7233ed4de9a699957ffb5b;p=thirdparty%2Fpostfix.git postfix-2.2-20040721 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 6517f04d5..0b687def3 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -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 diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index aa0ad76c7..ddbe6a123 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -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 diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index c0cde5e61..cee28fee2 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -5038,6 +5038,16 @@ The default time unit is s (seconds). maintains a limited pool of cached sessions.

+ + +
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.

+ +
session_cache_ttl_limit diff --git a/postfix/html/scache.8.html b/postfix/html/scache.8.html index ac46f7ce6..f03376e4c 100644 --- a/postfix/html/scache.8.html +++ b/postfix/html/scache.8.html @@ -98,14 +98,20 @@ SCACHE(8) SCACHE(8) The maximal time-to-live value that the session cache server allows. + session_cache_status_update_time (600s) + How frequently the scache(8) server logs usage + statistics with session cache hit and miss rates + for logical destinations and for physical end- + points. + MISCELLANEOUS CONTROLS config_directory (see 'postconf -d' output) - The default location of the Postfix main.cf and + The default location of the Postfix main.cf and master.cf configuration files. daemon_timeout (18000s) - 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. ipc_timeout (3600s) @@ -113,23 +119,23 @@ SCACHE(8) SCACHE(8) over an internal communication channel. max_idle (100s) - 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. process_id (read-only) - The process ID of a Postfix command or daemon pro- + The process ID of a Postfix command or daemon pro- cess. process_name (read-only) - The process name of a Postfix command or daemon + The process name of a Postfix command or daemon process. syslog_facility (mail) The syslog facility of Postfix logging. syslog_name (postfix) - 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 LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. HISTORY diff --git a/postfix/html/smtp.8.html b/postfix/html/smtp.8.html index 4264f3b54..6ff646a37 100644 --- a/postfix/html/smtp.8.html +++ b/postfix/html/smtp.8.html @@ -67,19 +67,20 @@ SMTP(8) SMTP(8) BUGS 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. CONFIGURATION PARAMETERS Changes to main.cf are picked up automatically, as smtp(8) - processes run for only a limited amount of time. Use the + processes run for only a limited amount of time. Use the command "postfix reload" to speed up a change. - The text below provides only a parameter summary. See + The text below provides only a parameter summary. See postconf(5) for more details including examples. COMPATIBILITY CONTROLS @@ -93,7 +94,7 @@ SMTP(8) SMTP(8) Never send EHLO at the start of an SMTP session. smtp_defer_if_no_mx_address_found (no) - Defer mail delivery when no MX record resolves to + Defer mail delivery when no MX record resolves to an IP address. smtp_line_length_limit (990) @@ -101,17 +102,17 @@ SMTP(8) SMTP(8) that Postfix will send via SMTP. smtp_pix_workaround_delay_time (10s) - 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. smtp_pix_workaround_threshold_time (500s) - 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. smtp_quote_rfc821_envelope (yes) - Quote addresses in SMTP MAIL FROM and RCPT TO com- + Quote addresses in SMTP MAIL FROM and RCPT TO com- mands as required by RFC 821. smtp_skip_5xx_greeting (yes) @@ -119,7 +120,7 @@ SMTP(8) SMTP(8) (go away, do not try again later). smtp_skip_quit_response (yes) - 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: disable_mime_output_conversion (no) - Disable the conversion of 8BITMIME format to 7BIT + Disable the conversion of 8BITMIME format to 7BIT format. mime_boundary_length_limit (2048) @@ -147,43 +148,43 @@ SMTP(8) SMTP(8) Available in Postfix version 2.1 and later: smtp_send_xforward_command (no) - 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. SASL AUTHENTICATION CONTROLS smtp_sasl_auth_enable (no) - Enable SASL authentication in the Postfix SMTP + Enable SASL authentication in the Postfix SMTP client. smtp_sasl_password_maps (empty) - 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. smtp_sasl_security_options (noplaintext, noanonymous) - What authentication mechanisms the Postfix SMTP + What authentication mechanisms the Postfix SMTP client is allowed to use. RESOURCE AND RATE CONTROLS smtp_destination_concurrency_limit ($default_destina- tion_concurrency_limit) - 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. smtp_destination_recipient_limit ($default_destina- tion_recipient_limit) - The maximal number of recipients per delivery via + The maximal number of recipients per delivery via the smtp message delivery transport. smtp_connect_timeout (30s) - 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). smtp_helo_timeout (300s) - 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. smtp_xforward_timeout (300s) @@ -191,30 +192,30 @@ SMTP(8) SMTP(8) command, and for receiving the server response. smtp_mail_timeout (300s) - 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. smtp_rcpt_timeout (300s) - 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. smtp_data_init_timeout (120s) - 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. smtp_data_xfer_timeout (180s) - The SMTP client time limit for sending the SMTP + The SMTP client time limit for sending the SMTP message content. smtp_data_done_timeout (600s) - The SMTP client time limit for sending the SMTP + The SMTP client time limit for sending the SMTP ".", and for receiving the server response. smtp_quit_timeout (300s) - 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). smtp_mx_session_limit (2) - 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). smtp_rset_timeout (20s) - 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: smtp_connection_cache_domains (empty) - The SMTP destinations for which SMTP connection + The SMTP destinations for which SMTP connection caching is enabled. smtp_connection_cache_reuse_limit (10) 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. smtp_connection_cache_time_limit (2s) @@ -251,46 +252,46 @@ SMTP(8) SMTP(8) TROUBLE SHOOTING CONTROLS debug_peer_level (2) - 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 debug_peer_list parameter. debug_peer_list (empty) - 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 $debug_peer_level. error_notice_recipient (postmaster) - 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. notify_classes (resource, software) - The list of error classes that are reported to the + The list of error classes that are reported to the postmaster. MISCELLANEOUS CONTROLS best_mx_transport (empty) - 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. config_directory (see 'postconf -d' output) - The default location of the Postfix main.cf and + The default location of the Postfix main.cf and master.cf configuration files. daemon_timeout (18000s) - 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. disable_dns_lookups (no) - Disable DNS lookups in the Postfix SMTP and LMTP + Disable DNS lookups in the Postfix SMTP and LMTP clients. fallback_relay (empty) - 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. inet_interfaces (all) @@ -302,25 +303,25 @@ SMTP(8) SMTP(8) over an internal communication channel. max_idle (100s) - 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. max_use (100) - The maximal number of connection requests before a + The maximal number of connection requests before a Postfix daemon process terminates. process_id (read-only) - The process ID of a Postfix command or daemon pro- + The process ID of a Postfix command or daemon pro- cess. process_name (read-only) - The process name of a Postfix command or daemon + The process name of a Postfix command or daemon process. proxy_interfaces (empty) 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. smtp_bind_address (empty) @@ -328,22 +329,22 @@ SMTP(8) SMTP(8) client should bind to when making a connection. smtp_helo_name ($myhostname) - The hostname to send in the SMTP EHLO or HELO com- + The hostname to send in the SMTP EHLO or HELO com- mand. smtp_host_lookup (dns) - What mechanisms when the SMTP client uses to look + What mechanisms when the SMTP client uses to look up a host's IP address. smtp_randomize_addresses (yes) - Randomize the order of equal-preference MX host + Randomize the order of equal-preference MX host addresses. syslog_facility (mail) The syslog facility of Postfix logging. syslog_name (postfix) - 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) SASL_README, Postfix SASL howto LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. AUTHOR(S) diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index cac7ae072..9b634befe 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -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 diff --git a/postfix/man/man8/scache.8 b/postfix/man/man8/scache.8 index 283283c4c..09de34baa 100644 --- a/postfix/man/man8/scache.8 +++ b/postfix/man/man8/scache.8 @@ -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 diff --git a/postfix/man/man8/smtp.8 b/postfix/man/man8/smtp.8 index b7feea688..a63cf55ec 100644 --- a/postfix/man/man8/smtp.8 +++ b/postfix/man/man8/smtp.8 @@ -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. diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 9ee27cacc..c8812327e 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -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.

+ +%PARAM session_cache_status_update_time 600s + +

How frequently the scache(8) server logs usage statistics with +session cache hit and miss rates for logical destinations and for +physical endpoints.

diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index db99a7c6d..5a9f693c2 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -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. */ diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 13f3b1872..d463b3fb5 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -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" diff --git a/postfix/src/global/scache.c b/postfix/src/global/scache.c index bc30b172d..3a913c732 100644 --- a/postfix/src/global/scache.c +++ b/postfix/src/global/scache.c @@ -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; diff --git a/postfix/src/global/scache_clnt.c b/postfix/src/global/scache_clnt.c index ff2f62cdd..38aabb025 100644 --- a/postfix/src/global/scache_clnt.c +++ b/postfix/src/global/scache_clnt.c @@ -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. diff --git a/postfix/src/global/scache_multi.c b/postfix/src/global/scache_multi.c index 2e7ca0152..1053fd992 100644 --- a/postfix/src/global/scache_multi.c +++ b/postfix/src/global/scache_multi.c @@ -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 diff --git a/postfix/src/scache/scache.c b/postfix/src/scache/scache.c index 70d271da4..b3b2c95a2 100644 --- a/postfix/src/scache/scache.c +++ b/postfix/src/scache/scache.c @@ -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 +#include /* Utility library. */ @@ -136,6 +141,7 @@ #include #include #include +#include /* 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); } diff --git a/postfix/src/smtp/smtp.c b/postfix/src/smtp/smtp.c index d51f011f3..60043c945 100644 --- a/postfix/src/smtp/smtp.c +++ b/postfix/src/smtp/smtp.c @@ -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. diff --git a/postfix/src/smtp/smtp_connect.c b/postfix/src/smtp/smtp_connect.c index bbc0ccacb..2e401af1c 100644 --- a/postfix/src/smtp/smtp_connect.c +++ b/postfix/src/smtp/smtp_connect.c @@ -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) {