Question

We are getting close to releasing our new rails app and so far interest seems very strong we are a little worried about where bottle necks will be. One seems to be system e-mails on signup and in other situations. Is this correct?

Should individual e-mails to users be sent asynchronously in the background? If so, what would be the best solution?

I have looked at a few solutions and can't seem to find anything definitive.

Was it helpful?

Solution

I would say it depends on your requirements. If you need to be able to inform the user that sending mail failed, do it in the same thread.

If not, sending mail should support things like retries etc, so I would put the message into a queue/the filesystem/database table/etc and have another thread/process deal with the details of sending.

OTHER TIPS

In the backgroud using http://github.com/tobi/delayed_job

Same thread, if you ask me.... by generating a file in a drop folder, which an email server picks up. Then there is not too much overhead, so a seaprate threads makes little sense.

At least this is how I always handle this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top