> On Feb 27, 2016, at 4:15 PM, Casey Connor <gmanepost...@caseyconnor.org> > wrote: > > We have a VM running postfix that receives all emails, analyzes the stream, > and "discard"'s 100% of messages via a custom milter in smtpd (i.e. a > pre-queue milter). > > In other words, it never enqueues any email. Thus, we were surprised to see > 'cleanup' processes running.
The cleanup(8) service accumulates the message content for processing, including milter processing. The smtpd(8) service just handles the SMTP protocol commands, the message content is passed to cleanup(8) and is opaque to smtpd(8). > Is it an expected part of the postfix architecture that cleanup must run even > for messages that are discarded? Yes. > If so, what should we do to ensure that cleanup is doing as little work as > possible? (E.g. no point in checking headers, etc.) No unnecessary processing is enabled by default. > In this scenario, would cleanup be doing any disk access? Yes, to accumulate the message content for milter processing. > If so, any way to avoid that? No. However if the message is rejected or discarded the final "fsync" required for messages that are accepted is avoided. The queue file need never hit the actual disk, depending on the file-system all the activity could be limited to the buffer-cache. In practice some disk I/O is likely, especially for larger files. > I have read some threads that imply that cleanup can't be disabled; Not if you want to do milter processing. With smtpd_proxy_filter and without "smtpd_proxy_options = speed_adjust", it is possible to do content inspection without cleanup(8), but that's a different architecture. You'd need to deploy a proxy filter rather than a milter. -- Viktor.