On Tue, Jul 14, 2015 at 06:04:37PM -0700, E.B. wrote: > Beginner question - I want to confirm that policy service running > under postfix spawn could have multiple instances running (if > there are multiple smptd processes) and so they should never > cache any important user data in local memory because they > would be out of sync with other instances of the same policy > service. Is that correct understanding?
The process limit for the policy service must not be lower than the combined process limit of all the smtpd services that connect to that policy service. The simplest way to do that is to set the spawn service process limit to 0. Since you're unlikely to have limited your system to just one smtpd(8) process at a time, there will be multiple policy services running concurently. However, all the requests from a single smtpd(8) service will go to the same policy service instance. So in memory caching can be used to construct per-transaction state (if, for example, the policy service fires for each recipient and also at data and/or end of data). However global caching (state per remote IP address, ...) would require that the various policy service instances update some shared external resource. > Is there any common solution to share memory between script > instances? Only way I think of is to set maxproc 1 or use tool like > memcache or go make it into a external daemon. You MUST NOT set the process limit to 1. Using an external shared resource can be an option. Or don't use spawn. -- Viktor.