Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I use postfix to do final delivery for a mail system I've written. So this postfix installation only accepts mail from me, and bounces. When the postfix queue is empty, it can accept a piece of mail in 5ms or so. When the queue has 150k-200k messages or so, the handoff speed from me to postfix is really slow, like 50-100 sometimes 500ms.

I have log times on every piece of the SMTP conversation, so I can see where the time is going. Some of it is when I'm waiting for a response from the RCPT TO command, but the vast majority of the time disappears after I send the final dot, before I get the "250 okay queued as..." response.

I'm thinking maybe the RCPT TO delay is in a DNS lookup, but that doesn't help me with the queuing time. I keep one TCP socket open for all the email I'm sending, and I RSET the conversation for each mail, so there's no time lost to making and breaking TCP connections, it's all waiting for postfix to queue the message.

Everything I've read about performance tuning postfix has to do with queue management and sending mail for this and that domain here and there. But I'm concerned with getting postfix just to accept the mail quickly in the first place.

Is there any way to find out what postfix is doing with all this time or is there a way to make it go faster? The /var/spool/postfix queue is on local disk, so I can't make that any faster.

Any suggestions?

share|improve this question
1  
please paste some configs of postfix and logs it will help to find solution –  B14D3 Nov 22 '11 at 16:33
    
STOP SPAMMING. 150k-200k is not a usual mail volume unless you are an ISP. And they have multiple outgoing servers to cope with that. –  mailq Nov 22 '11 at 18:25
    
@mailq - it's not an unusual mail volume for a school, for example: the university I went to had routine mail queues in that range and only a pair of mail servers (5k students + 1.5k facstaff) –  warren Nov 22 '11 at 20:27
    
Which means even in worst case only 6.5k mails at a time. –  mailq Nov 22 '11 at 22:19
    
I'm not spamming, but I appreciate your concern. If you want to stop spamming, you're talking to the wrong guy, you want to be designing a better mail system that isn't as inherently designed NOT to prohibit spam as SMTP. –  Stu Nov 23 '11 at 21:04
add comment

2 Answers

Set the following in main.cf

hash_queue_depth = 3
hash_queue_names = deferred, defer, incoming, active

This produces subdirectories in the incoming and active queues so that the flat directories don't contain all mails at once. They are now put into subdirectories.

But note: Having 150k-200k messages waiting for delivery shows an incredible wrong understanding of a balanced sending of mails. This looks like spamming to me...

share|improve this answer
    
Looks like a duck, quacks like a duck, but every once in a while, it's not a duck. –  Stu Nov 28 '11 at 21:33
add comment

One of the solutions was to have a secondary mail server that handles all the bounces that are waiting to be delivered, this was the best solutios to keep the real email going through.

share|improve this answer
    
bounces aren't a big part of the equation and the machine has tons of capacity so I can't imagine that the few bounces we get are really slowing it down. –  Stu Nov 23 '11 at 21:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.