Reputation: 4566
On my localhost
, sending a confirmation email with the devise
gem via gmail takes, on average, five seconds with an observed ceiling of almost ten seconds. After doing some research, it appears this is the norm and thus, it is recommended to have your server handle email delivery asynchronously. What part of the process is causing delays? Using a browser to log in to gmail and send an email could probably be done in a shorter time than ten seconds. Is the server waiting for some kind of response that its sent email was received?
Upvotes: 0
Views: 84
Reputation: 20232
I doubt you could log into the gmail and send a message quicker but maybe. But the delay is caused by tcp connection overhead , ssl negotiation, SMTP authentication. There could also be some artificial delay introduced in terms of anti spam measures or SMTP banner delays. Then you need to transfer the message and wait for the server to say ok and the tear the connection down before the deliver method returns. You could run your own queuing mail server on you web hosts that does do ssl, doesn't do auth, etc and it would be way faster. It could then either smart host via your upstream or say something like google. This would return control to your rails app faster and let the mail server handle queuing, back off, and the like as opposed to having the rails app wait on submission.
Upvotes: 1