Mautic Community Forums

Parallel sending e-mails with Amazon API

Your software
My Mautic version is: 3.3
My PHP version is: 7.3
My Database type and version is: MySQL 8
My VPS: Linode 1 CPU CORE with 2GB RAM(just php project) and Linode 2 CPU CORE with 8GB RAM (to database MySQL)

Your problem
My problem is:

Hi guys!
I have a database with more than 300k leads, and we use it to marketing and transactional emails.
We use amazon SES API to send. It have a better performance than trough SMTP.
On Amazon SES we have 250k daily quote and 70 emails per second limit.
In a simple campaign for all of those customers, we need speed to proccess off all this messages… With one thread running sent it will be take a looot of time.

In others threads here the discuss of paralleling trigger was mentioned, but i have some questions about this:

1-) Whats happens when mautic:email:send --message-limit=300 -f (yes, with force option) is called?
It will get differents batchs of 300 from spool list, or exist chances of different proccess get the same batch of messages to send?

2-) How can i configure cron to works with a lot of emails queued on list? Whats is the best config?

3-) How ajust cron to be possible sent 70 emails per second?

I think that @joeyk have a good explanation about this on this topic (Matching SES send rate - #5 by joeyk) … And i got some inspirations here!
But, on the same topic @nick-fm call to the fact that config would take 1min to send 60 messages and sugested the possibility to run cron parallelized.

Hey,

You can speed up sending, but giving such advice feels like telling someone how to drive with 200 km/hour.
In the woods.
With a skateboard.

Yes, you can set the 1 min limit for sending emails.
This is what I use:
php mautic:emails:send --time-limit=47s --lock_mode=flock
Why 47 percent? because I run this every minute and my system needs 10 sec to start really processing. +3 sec is for safety.

Yes, you can have a different process select the same emails. But if you add a 15 sec delay on the second thread, then the risk is minimum. Do the force option too.
This is the format:
command1 & sleep 15; command2 &

+1 tip: you can also fill up the spool before sending, that helps. Cause spooling is usually 30% of the total time spent on sending.

By using this technique I managed to send REALLY FAST, however my deliverability went down. So use it with caution.

Read this great post for further creative - not safe at all - solutions:

1 Like

Hi @joeyk !

What do you mean by “fill up the spool”. How to do it? Thanks!

If you use queue email setting, and run the mautic:broadcast:email command, then no send will be done, but the emails will be generated and added to the spool. If you use 5 threads of mautic:emails:send, then your email sending is faster then your email generation. But if your spool is filled up already and the emails are ready to go, then all you need to dedicate your resources is to send the ‘ready’ emails out.

1 Like