Thanks a lot Wietse, the problem was the PHP script not being reused. Problem fixed.
Huge thanks to everyone here, you guys are awesome! Thanks!!! Em seg., 8 de nov. de 2021 às 14:55, Wietse Venema <wie...@porcupine.org> escreveu: > Rafael Azevedo: > > Hi there, > > > > We're testing a custom filter for PHP using spawn services. > > > > During our tests, we noticed that every time that we invoke the > > check_policy_service through docker container it takes about 1 second to > > run the filter script. > > The mistake is to EXIT the PHP script. It should be written as a loop: > > while (true) { > receive request > if EOF, exit > send response > } > > And it should have a command time limit as described in > http://www.postfix.org/SMTPD_POLICY_README.html > > On a busy server this will reuse the PHP process multiple times, > only the process startup will be slow. > > To improve performance further, you would not use the spawn service, > but run the script as a long-running process that accepts connections > itself. > > Wietse >