-1

I am currently using a Mac Mini Server running OS X Server. The server hosts several Ruby on Rails applications using Phusion Passenger where two of them uses a PostgreSQL database. One of these applications has a mailing list database that uses ActionMailer to send emails. As of the writing of this post the application will send 224 emails when we send a newsletter out.

We were using a GoDaddy email address in the SMTP configuration. The emails took only five minutes to send. However GoDaddy only allows 250 emails to be sent per day. They also only allow you to purchase relays 50 at a time with a three month minimum. We were not sure how well that would work for us with the growth of our mailing list. At the rate we are growing we could add 50 people to the mailing list sooner than three months we would have already paid for. I felt that we should visit turning on the Mail Server on our Mac Mini Server.

After getting some questions answered from Apple I was able to get the Mail Server working where I can send and receive emails. However when I send those same emails it takes 30 minutes instead of five. The documentation for OS X Server still has old information from Lion Server referencing Server Admin Tools which no longer apply for OS X Server.

I was hoping that the time to send emails might be the same since the database for the Rails application and the mail server were on the same machine. However in general I understand in some cases there could be some contention with using the same resources. Is there is any way that I can speed up the sending of the emails? Unfortunately Server Admin Tools has not been provided for OS X Server. The documentation for OS X Server is for the most part worthless since they reference Server Admin Tools which no longer exists.

Any help would be appreciated.

UPDATE 3/15/2013 10:15 am CST

Note: I am new to working with Mail Servers. Correction about the time. When I checked /var/log/mail.log I saw that the total processing time was about 41 minutes, not 30. When I checked production.log in my Rails application I watched as each email was being sent successfully. The mail log confirmed that they were being sent one at a time.

Here are the log entries for one of the emails with masked data. I also included the last log statement when the previous email was successfully sent.

Mar 14 11:06:50 hostname.domain1.com postfix/qmgr[45322]: 4B2C5603D25: removed
Mar 14 11:06:59 hostname.domain1.com postfix/smtpd[99464]: sacl_check: mbr_user_name_to_uuid(emailuser@emaildomain.com) failed: No such file or directory
Mar 14 11:06:59 hostname.domain1.com postfix/smtpd[99464]: sacl_check: mbr_user_name_to_uuid(@emaildomain.com) failed: No such file or directory
Mar 14 11:06:59 hostname.domain1.com postfix/smtpd[99464]: 28899603D28: client=hostname.domain1.com[208.52.189.83], sasl_method=PLAIN, sasl_username=iosusername
Mar 14 11:06:59 hostname.domain1.com postfix/cleanup[99468]: 28899603D28: message-id=<5141f599b105_17b1c3fc6cdc290d811372e@hostname.domain1.com.mail>
Mar 14 11:06:59 hostname.domain1.com postfix/qmgr[45322]: 28899603D28: from=<emailsender@senddomain.com>, size=6545, nrcpt=1 (queue active)
Mar 14 11:06:59 hostname.domain1.com postfix/smtpd[99464]: disconnect from hostname.domain1.com[208.52.189.83]
Mar 14 11:06:59 hostname.domain1.com postfix/smtpd[97748]: connect from localhost[127.0.0.1]
Mar 14 11:06:59 hostname.domain1.com postfix/smtpd[97748]: 6F4DD603D2F: client=localhost[127.0.0.1]
Mar 14 11:06:59 hostname.domain1.com postfix/cleanup[99478]: sacl_check: mbr_user_name_to_uuid(emailuser@emaildomain.com) failed: No such file or directory
Mar 14 11:06:59 hostname.domain1.com postfix/cleanup[99478]: sacl_check: mbr_user_name_to_uuid(@emaildomain.com) failed: No such file or directory
Mar 14 11:06:59 hostname.domain1.com postfix/cleanup[99478]: 6F4DD603D2F: message-id=<5141f599b105_17b1c3fc6cdc290d811372e@hostname.domain1.com.mail>
Mar 14 11:06:59 hostname.domain1.com postfix/smtpd[97748]: disconnect from localhost[127.0.0.1]
Mar 14 11:06:59 hostname.domain1.com postfix/qmgr[45322]: 6F4DD603D2F: from=<emailsender@senddomain.com>, size=7038, nrcpt=1 (queue active)
Mar 14 11:06:59 hostname.domain1.com postfix/smtp[99473]: 28899603D28: to=<emailuser@emaildomain.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.3, delays=0.01/0/0/0.29, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 6F4DD603D2F)
Mar 14 11:06:59 hostname.domain1.com postfix/qmgr[45322]: 28899603D28: removed
Mar 14 11:07:00 hostname.domain1.com postfix/smtp[97741]: 6F4DD603D2F: to=<emailuser@emaildomain.com>, relay=mx-eu.mail.am0.yahoodns.net[77.238.177.9]:25, delay=1.1, delays=0/0/0.34/0.79, dsn=2.0.0, status=sent (250 ok dirdel)
Mar 14 11:07:00 hostname.domain1.com postfix/qmgr[45322]: 6F4DD603D2F: removed

UPDATE 3/15/2013 4:11 PM CST

I continue to check things. I decided to send 5 emails using the same software I had problems with the time. They are still sending slower than with the GoDaddy email account. I decided to take a look at sacl_check message where it did not find the file or directory. This message appears for each email that I checked. I read this link below that discussed this. One of the comments mentioned that some settings needed to be made in file /etc/postfix/main.cf. I have my email setup for local networks only. The other option was to forward somewhere. I was advised by Apple Enterprise Support to set it up like this since it will only be used by ActionMailer in my Rails applications to send emails. No emails will be received by the email address I created. I have not modified /etc/postfix/main.cf. I'm not sure which modifications I need to make. There will never be local users as such to verify.

https://discussions.apple.com/thread/3241121?start=0&tstart=0

2 Answers2

1

You'll need to do some troubleshooting to see where the bottleneck is. First, where are the messages piling up: does it take 30 minutes for ActionMailer to feed the messages to postscript (the MTA used by OS X Server), 30 minutes for postscript to start sending the last of the messages, or 30 minutes for postscript to finish sending the last of the messages? This'll give you at least some idea where to look for the slowdown.

There are a couple of specific things to look at when tracking down problems like this. First, check /var/log/mail.log to see how the messages are being handled by postfix. You'll have to do some work to reconstruct what happened to each message, finding the log entries relating to it as it's processed by various parts of postfix, and figuring out what happened to it, where it spend its time between being received and being sent to its destination.

Second, run sudo postqueue -p to show all of the messages postfix has in its queue at the moment, along with (if appropriate) what happened when it tried to send the message (note: your server will now be trying to transmit messages to a number of different destination servers, some of which will have delays, errors, etc; it's totally normal for a few messages to get stuck for a few minutes, hours, or days waiting for something to clear up on the other end).

One specific thing comes to mind: make sure the server is able to resolve DNS names quickly. If it has lookups failing (and messages sitting stuck while it tries to look something up), it can insert considerable delays in the system.

Gordon Davisson
  • 11,216
  • 4
  • 28
  • 33
  • I have checked mail.log. I posted the log entries in my description. One thing I am noticing is that after the last statement with :removed there is a 9-10 delay before the next email begins to send. This would account for the difference in time. I was sending 224 emails. At 2 seconds each it should have taken maybe 8 minutes max to send them. Taking 10-12 seconds each would equal close to the time I experienced sending the emails. Just from this it does not appear that anything else was delayed. Is there a setting I can change to not have it delay so long between each email – Pamela Cook - LightBe Corp Mar 15 '13 at 15:42
  • I have updated the description again with more research that I have done about one of the messages that appears for each email I have reviewed since my last update. Thanks for your help. – Pamela Cook - LightBe Corp Mar 15 '13 at 21:41
  • Good answer GD. But LC still hasn't got a handle on where the bottleneck is. There's a whole load of things which will make PostFix go faster - but it does look like the problem is in the application. The logs imply SMTP - but you're not reusing the connection. Also you're only running a single thread to pass the emails on to the mailserver. Why are you running sacl checks on outgoing emails? – symcbean Mar 15 '13 at 22:12
  • Apple Enterprise support suggested that I set the email address up for within the local network which from my research will perform the sacl checks. I'm trying to avoid forwarding them, the only other option. Emails are sent from my Ruby on Rails application. The emails are sent single thread. However when I run the code using my GoDaddy email address they send in about 8 minutes. Using the Mail Server on my Mac Mini Server it takes 41 minutes. I am looking at how to stop the sacl checks if possible along with hopefully other options. Thanks so much syncbean. – Pamela Cook - LightBe Corp Mar 18 '13 at 19:49
1

Most "speed" issues in regards to email come down to a couple things:

  1. filtering. If you are running spamassassin or some other filter, try disabling it temporarily to see if it speeds up.
  2. DNS issues. Make sure you dont have recursive cnames or something goofy going on. Make sure that everything resolves properly inside the network, as well as outside the network.
  3. check for mail loops. Usually your MTA will tell you this inside of the MTA logs.
Mike Perez
  • 11
  • 2
  • THanks so much for your suggestions. You and Dan have given me great places to check. I am posting the results of my research in the description. – Pamela Cook - LightBe Corp Mar 15 '13 at 21:42
  • I do not understand why my question was closed. I asked for help with what places to look on my MacMini server in order to speed up the sending of emails. Your help stated that we should show our research. I continued to post what I have done. Some of what I added was in response to the comments I received. My last post referenced something I added earlier in my description. I was hoping on input on the last link. I'm not sure why it was closed, especially since two people commented directly to what I was presenting. Thanks for clarification as to why this was closed. – Pamela Cook - LightBe Corp Mar 18 '13 at 19:33