Email Send Queue issue

I have a bit of an issue with our settings and was wondering if you could clarify if it was intended design or if we might have something setup wrong on our end?

The .bat file we are running contains the following:
mautic:emails:send --message-limit=150
mautic:segments:update --batch-limit=900
mautic:campaigns:update --batch-limit=300
mautic:campaigns:trigger

Their are two issues we have with this setup that we were wondering about

  1. When I create a segment that has say 10k users on it and create a campaign to use that segment to send an email to the users what happens is an email for all 10k users is created in the var\spool at the first run of the batch file. This takes up to 15-20 minutes to complete. This means that our regular sends stop happening until all those backlog emails are completed. Is there a way to have it only create backlog items for a set number of users? As a note this could be slower to create because of some customization we have, I’m not sure if it’s usually this slow to create 10k emails in the backlog or not.
  2. The email sent date for all users is set to the time it was processed. So for example one of our users is recorded as having the email sent at 10:18 am, but it wasn’t actually sent until it was picked up in the queue 22 minutes later. This is less of an issue, and would probably be fixed by the first issue if there was a way to set that up (it might be a couple minutes off but there wouldn’t be 10k emails in the queue to go through).

Thanks for any help!

These are the variables for mautic:campaigns:trigger [-i|–campaign-id [CAMPAIGN-ID]] [–campaign-limit [CAMPAIGN-LIMIT]] [–contact-id [CONTACT-ID]] [–contact-ids [CONTACT-IDS]] [–min-contact-id [MIN-CONTACT-ID]] [–max-contact-id [MAX-CONTACT-ID]] [–thread-id [THREAD-ID]] [–max-threads [MAX-THREADS]] [–kickoff-only] [–scheduled-only] [–inactive-only] [-l|–batch-limit [BATCH-LIMIT]] [-f|–force] [–bypass-locking] [-t|–timeout TIMEOUT] [-x|–lock_mode LOCK_MODE] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

You can use these to modulate campaigns or 1 specific campaign to process at a rate that matches your email sending. This will help eliminate bottlenecks.

Thanks, I also found your post here which is very helpful
(Mautic Command Options and Arguments)

This should help with my trigger I will look at updating this, I was wondering if maybe [BATCH-LIMIT] doesn’t work as I expected as well?

These were some of the notes for mautic:segments:update in the link above.
-b, --batch-limit[=BATCH-LIMIT]
Set batch size of contacts to process per round. Defaults to 300. [default: 300]
-m, --max-contacts[=MAX-CONTACTS]
Set max number of contacts to process per segment for this script execution. Defaults to all. [default: false]

However when the above runs mautic:segments:update --batch-limit=900 it adds all 8k contacts to my segment in the first run. If I were to only want to add 900 at a time would I have the user the MAX-CONTACTS instead? If so do you have a better idea of exactly what ‘Set batch size of contacts to process per round.’ this pertains to?

As a note, I did update to --max-contacts=900 and it works as expected. This makes me think I’m misunderstanding batch-limit. Does it basically loop through and process x number at a time however if the max-contacts isn’t set it will process them all?

So say I wanted to process 100 at a time, but process 300 total for a run I would set --batch-limit=100 --max-contacts=300. What is the advantage of this, just that processing 100 at a time and 300 total causes less of a spike?

1 Like

Batch limit is how many are processed at a time for the entire task and max contacts limits the process to the desired number per command execution. In other words the batch breaks down the number of contacts processed to whatever you desire, and max contacts will only process the desired number and stop.