The same connection is generally used for related lookups from the same
process, but a busy server there are many smtpd(8) and cleanup(8)
processes and it is best to use proxyread(8) to consolidate database
connections:

    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.

Does the proxy open a connection to mysql when it is spawned? Or does it wait until it gets a query request from smtpd?

Once proxy has processed a request, how long does it hold that open connection with mysql?

Do i need to be mindful with mysql connections over network? If the connection is held open for a long time and latency or packet loss are an issue does it effect the next incoming query request from smtpd? A possible non lookup resulting in a failed mail delivery?

proxymap(8) talks about "request" such as open, lookup, update, delete, sequence. Is this something i should be using or specifying somewhere? Or is the manual just explaining inner workers and as a user i don't directly interact with them?

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?

In master.cf i don't see a proxy but there is proxymap and proxywrite. Does this mean "proxy" isn't a real service but depending on the query (select vs update) either proxymap or proxywrite gets spawned? I see proxywrite has a maxproc of 1, is that a concern that only one process can be spawned will that create a bottle neck? I don't think im using writes as all my lookup tables use select queries, so should i even care that it is 1?

And just to confirm im understanding everything. Normally a single smtpd process can process several in-comming connections and thus accept multiple emails at once. Without using proxy that one stmpd process would open a separate mysql:/ connection for each incoming message. Using proxy:mysql:/ then that one stmpd process would send multiple query request to proxy: who then would open only one mysql connection for those multiple emails. You would end up with as many proxymap processes as you have smtpd processes and only as many open mysql connections as you have smtpd processes, which by default is 100 processes. Is all of that correct?

Reply via email to