I am using Mautic 4.2 and Amazon SES which has currently 14/sec max. send rate. However, I am not being able to send more than 7/sec of emails using queue. I have to be ready for future which might need about 300/sec.
I have checked that infrastructure is not a problem as I cant see spikes on CPU or Memory or Network etc in Mautic server
I am using cron jobs to send emails but to test emails/sec I directly run command in console as below
a. Firstly I populate queue in spool using campaign rebuild and trigger
b. Count total no. of emails in queue say 1000
c. Run command to send email say 800 per minute
/bin/php /var/www/html/mautic/bin/console mautic:emails:send --time-limit=60 --message-limit=800
d. Count total no. of remaining emails in queue and it is around 500 to 550
So that is the problem there, I was expecting Mautic to complete 800 per min as in command but something is wrong there. Can you please help me with this problem?
Also I tried to run same command with diff. locks which exceeds max send rate, However, it does not reach 800 per min anyway.
I looked into the post you referred but as mentioned in Optimize part, I try to send 790 with below command but I find that Mautic is not able to send 790 per minute, it just sends 500 per minute
The reason:
Your server is too slow. You’d need to investigate the bottle neck. (DB, memory, CPU?)
At the same time I would be cautions with sending so fast. If you exceed the limit, you lose emails.
Joey
Server CPU /memory showing OK values when you run HTOP doesn’t mean that you fully utilize it. You need to tweak your DB and PHP settings in a way to speed up send.
Mautic 5 will speed up email sending by 3,5x. I’s wait for that couple of months.
Joey
Hi, I can’t give you optimization advice as I don’t know your environment. I suggest you post a job in the forums.
I hope someone can solve it. Joey
I applied multi-threading to send emails and got success to achieve a faster send rate like with one thread is 10/sec and I have applied 5 threads which gives 50/sec throughput.
However, I have found that there is an issue with duplicates. Same email gets sent multiple times when multiple threads are used.
Thanks @joeyk for your advice. I set time limit of 45 sec and message limit of 300 but there are still duplicate emails in the inbox. Can you please review below command? Thanks, appreciate your help
@joeyk , Thanks for your suggestion, I tried this and ended with duplicates again. Then I investigated a little bit and I found that when using multi threading, some threads collide with each other and they give some warning that there is no file *.sending and thus results in failed message.
These failed messages are then picked up again as configured in system. So, I configured not to retry failed message and wipe them out. Then there are no duplicates now. I know that this is not 100% accurate solution as there might be true failure sometimes that we want system to resend again.
Anyways, I am still surprised at why multithreading is not working as expected even though I have added lock_mode=flock.
Hi, @sun123 Im facing the same issue with the duplicates, how you did to configure not to retry the failed messages and wipe them out??
Thank you in advance!!
You’ll want to see the above post^ This patch to swiftmailer should solve your duplicate send issue. works well for us, and we were able to run multiple sending crons at the same time
Using the above code, we benchmarked some email tests. This code runs 3 send commands at the same time, which is about 18 emails per second to our SMTP sever… which is too fast. We’re going to only run 2, or about 12.5 emails per second.