A few months ago, we had a customer come in complaining of slow sending speeds. Even the simplest of emails was taking 2 or 3 seconds to deliver. That may not seem like a lot, but if you're sending thousands of messages on a single thread, it can quickly add up to hours. Our servers routinely spent about 50 milliseconds processing their mail, so that was eliminated as a possibility. The customer's servers were in France and had a 250 millisecond ping time to our servers in Texas. That's pretty far, but still far short of 3 seconds.
The problem: SMTP is chatty
The key to this little puzzle is that the customer was using SMTP to send their mail. That's not too surprising; about 60% of the email that goes through Mandrill is sent using SMTP. The problem is that SMTP is designed as what we nerdy types like to call a chatty protocol. To send a single email using SMTP, you have to send multiple separate commands to the SMTP server and wait for a response on each one. The farther you are from the SMTP server, the longer you have to wait for each response. Here's a basic breakdown of a simple SMTP conversation (see wikipedia or the SMTP RFC for more detail):
Client: Hello, Server Server: Hello, Client Client: I'm actually user myusername, password is baconlover1234 Server: Okay, I remember myusername. What do you want? Client: I'd like to send an email Server: That's cool. I like email Client: Can you send it to firstname.lastname@example.org? Server: Yes, that's an email address. So far, so good Client: Ready for me to give you the email? Server: Ready when you are Client: Here's the email Server: Okay, it's sending
Every time the client says something to the server and waits for a response, it must wait at least the ping time before it can proceed. All that waiting adds up quick.
The servers need to be closer
The chattiness issue is built-in to SMTP and cannot be changed, so the only way to make Mandrill faster for far-away users it to make sure that Mandrill's never that far away. A few weeks ago, we moved our entire SMTP relay infrastructure up to AWS and started launching SMTP servers all over the globe.
You don't have to do anything to take advantage of this. When you try to connect to smtp.mandrillapp.com to deliver your mail, we'll route you to the closest available region to ensure the highest performance. As of today, we have servers in Singapore, Ireland, and both the east and west coasts of the United States. As Mandrill's global traffic grows, so will our expansion into more regions of the world.
Don't worry, none of this changes the deliverability of your emails. All Mandrill emails are still going out through our own managed IP addresses running on our own dedicated hardware in our own datacenters, exactly the same as before.
We're not done
Expanding our servers like this was a huge change, but we're not even close to finished. Mandrill's focus for the beginning of 2013 is to make our email delivery service the fastest and most robust on the planet, so buckle up.