MAUTIC not handling 2 or more campaigns simultaneously

Your software
My Mautic version is: 5.0.3
My PHP version is: 8.0.28
My Database type and version is: MySQL 8.0.35

Your problem
My problem is:
I’ve noticed through my time using MAUTIC that it is unable to handle 2 or more campaigns simultaneously. I was under the impression that perhaps 5 would be different but discovered pretty early on that MAUTIC is still unable to handle 2 or more campaigns simultaneously.

These errors are showing in the log:

Steps I have tried to fix the problem:
Set 2 separate campaigns, each containing chains of mailings set to go out in the morning. I discovered that while their delivery hour is the same, MAUTIC sends one of them and only once it finishes does the mailing from the other campaign go out.

Unless you run the cron simultaniously by specifying your campaign ID

* * * * * php path/bin/console mautic:campaigns:rebuild --campaign-id=1
* * * * * php path/bin/console mautic:campaigns:rebuild --campaign-id=2

* * * * * php path/bin/console mautic:campaigns:trigger --campaign-id=1
* * * * * php path/bin/console mautic:campaigns:trigger --campaign-id=2

I would also add some limits if needed.

php path/bin/console mautic:campaigns:trigger --help

Update: maybe you need to add --bypass-locking

I hope this works for you.

Why would a simple end user have to or want to deal with individual crons for each individual campaign?
It makes no sense.
I set 2 campaigns to work in parallel. My expectation is that the system would know that I have set 2 or more campaigns and send out mailings from each campaign, and if I set them at the same hour, the system would know how to handle it in parrallel and not wait for one mailing to finish before sending out the mailing from the other campaign.

Hi @omert - its still a bit unclear what you are trying to achieve. Usually Mautic runs several campaigns in sequence and thats fine for most end users. Campaigns run all the time around the clock, so whether sequential or in parallel makes no much difference.

Are you talking about bulk mail sendings in large quantities? Does one mailing block your instance for such a long time, that its already to late for the next mailing? Sending mails via API and the right email service providers will be pretty fast.

You may then think about scaling your Mautic. People run Mautic to their requirements - in large clusters etc. Maybe investigate more into queuing mails.

But really - without your usage scenario its not easy to give helpful answers.

So how long is your campaign (automation) running? :slight_smile:

Hi, @dirk_s and @joeyk . I’m talking about 2 separate 2-week-long campaign automations which I’ve set to run. Both have 14 “modules” (1 for each day of these 2 weeks). Each “module” is set to send out an email at 7:00. But, as I’ve said, when it comes to 2 or more campaigns, one campaign mailing is sent and it is only when it finishes that the mailing from the other campaign is sent. This behavior has been going on for as long as I remember using MAUTIC and it is somewhat peculiar that this has not yet been resolved because, for example, if we take 1 campaign and run a manually delivered “Segmented” mailing while it’s running then MAUTIC would have no problem tackling it but if we have 2 mailings from 2 “Campaign automations”, if that’s what you want to call it, then we’re back to the persisting problem.

The point I’m trying to make is that, as you know, delivery time is important.
If one mailing takes an hour or two or three to complete and the other mailing starts at an hour or two or three delay, it impacts the mailing’s effectiveness, wouldn’t you agree?

How many mails are we talking about? If a mail shot takes 2-3 hours, we are not talking about the standard use case anymore. Its an interesting case, as it really means that you will need to either tweak your mail sending speed… or somehow to spin up several processes (@joeyk was about to start into that discussion.)

But first things first… Is there a way to speed up your mail sending process?

On the other hand: sending many mails in a short timespan also may be countering your email delivery goal.

Read more here:

" Important

Optimized shared delivery might result in preemptive delays to your emails being sent in an attempt to protect your sending reputation. If you have a critical workload that must be sent without delay, we recommend that you don’t enable this setting. Instead, use configuration sets for sending, and only enable optimized shared delivery for those configuration sets where you can afford delays."

Also:

ISPs can also soft bounce emails as a form of throttling – if they see too many emails delivered too quickly they sometimes interpret that as a spammer trying to attack their customers.

You probably need balance: delivery on time vs. delivery at all?

Hi,
this is super interesting for me, I have never heard complaint about this.
I’d like to explain how I would set this up.

Let’s say I have 2 campaigns, each 14 emails sent every day. Each campaign has 10.000 subscribers. Both campaigns have to go out 7:00 am in the morning.
It means my output is 20:000 emails.

My ESP is Amazon SES, they allow me 14 emails / sec. that is 1428 seconds or 23 minutes. That is the first bottleneck. Even if I send with full speed available to me, there will be some contacts receiving my email at 7:23.

And as @dirk_s pointed out, Amazon SES will even throttle you, so my real delivery speed might be even less.

These are circumstances outside of Mautic.

But Mautic has also some bottlenecks before you reach that number, so let’s eliminate those:

Use queued email sending
Email sending consists of 2 parts: 1. creation 2. send. Unless you use a queue both processes are done by the campaign trigger command. It takes longer to produce and send, therefor it makes sense to separate and pre-create your emails.
If you use queue emails from the 2 campaigns will be sent out in a mixed manner.

Max out campaign trigger speed
You can measure how long it takes to run the campaign. Make sure your crons are running often enough, in other words when one cron ends, the next one should start. Forget the 15 minute cron, do a one minute cron. In Mautic 5 you can even create campaigns paralel with multiple threads. check the --help command to see more.

Use multi thread sending to push out emails faster
Mautic 5 can do multi-thread sending of emails. The speed is up to you and your resources. Make sure you are not sending too fast, because the feedback loops / clicks / opens can overwhelm your system, not to mention you don’t want to be banned by your ESP for being hyperactive.

Would be nice to understand the total scope by disclosing how many emails you want to send in each campaign.

I hope this helps.

1 Like