On Sun, Jul 25, 2021 at 03:25:44PM -0400, [email protected] wrote:
> > virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_email_aliases
>
> I read over proxymap(8), mysql_table(5) and DATABASE_README but don't
> fully understand how the proxy works. I get the concept, but im curious
> on the mechanical happenings.
The internals are not documented. You're welcome to RTFS, but the basic
idea is that you get connection reuse across multiple processes making
queries via a common proxy process. This substantially reduces
connection concurrency as seen at the database server.
> Does the proxy open a connection to mysql when it is spawned? Or does it
> wait until it gets a query request from smtpd?
A sensible approach is taken in the implementation.
> I assume other than just putting proxy: in front of mysql:/ there is
> nothing more i need to do to utilize the lookup proxy service?
The only other concern is to make sure that the table in question
is (typically indirectly) listed in $proxy_read_maps. To check:
$ postconf -xh proxy_read_maps |
sed 's/[, ][ ,]*/\n/g' |
grep '^proxy:' |
sort -u
> Normally a single smtpd process can process several in-comming
> connections and thus accept multiple emails at once.
This is false. A single smtpd(8) process accepts and handles one
connection at a time. When that connection terminates, it may
accept and handle a new connection, subject to $max_use and $max_idle.
> Without using proxy that one stmpd process would open a separate
> mysql:/ connection for each incoming message.
This is false. Database connections are typically kept open for reuse
for the lifetime of the process, but may be reopened if necessary.
> You would end up with as many proxymap processes as you have smtpd
> processes
No, because the smtpd(8) processes don't spend all their time making SQL
queries, and a proxymap(8) process accepts multiple connections, and
processes queries from multiple smtpd(8) processes.
> and only as many open mysql connections as you have smtpd processes,
> which by default is 100 processes. Is all of that correct?
Pretty much none... But the recommendation to use "proxy:" stands.
If you're using MySQL, PgSQL or LDAP, use "proxy:".
--
Viktor.