Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about processing the payload #38

Open
echan00 opened this issue Jan 11, 2016 · 2 comments
Open

Question about processing the payload #38

echan00 opened this issue Jan 11, 2016 · 2 comments

Comments

@echan00
Copy link

echan00 commented Jan 11, 2016

I'm currently processing the payload via background processing (such as delayedjobs) even though the processing is very minimal. Is this the right way to go about it?

Also, what happens if there are many events coming from Mandrill? Is it smarter to batch the events to process them multiple at a time? If so, would love a few pointers.

@tardate
Copy link
Member

tardate commented Jan 11, 2016

Hi @echan00

I don't know if there are any hard and fast rules here .. a lot probably depends on your mail volumes, your server infrastructure, and the complexity of the mail processing you required.

However I can say that for all the deployments I've used mandrill webhooks (range from low to 10k messages/day):

  • as a rule, I always throw the payload on background queues (DelayedJob and resque) to minimise load on the web tier, and make background processing manageable/distributable
  • that means always one event per background job (i.e. not batched multiple events into a single background job)

This keeps things clean and decomposed, and I've yet to hit any case/issues that would make me think about optimising this by trying to batch multiple events in one background job.

And bearing in mind that Mandrill has complete discretion over whether it's going to send you 1,2,.. 10 or 100's of events in a single webhook call - regardless of how much mail you are sending - it is quite a hairy proposition to contemplate an optimisation that pre-supposes multiple events coming in as a single POST from mandrill.

@echan00
Copy link
Author

echan00 commented Jan 12, 2016

Thanks @tardate, very useful information.

I did not know that Mandrill may send more than 1 event in a single webhook call. But good to know. I suppose since this gem already breaks down a call into multiple events, not much can be done anyways. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants