High CPU on mautic:campaigns:update cron

Your software
My Mautic version is: 4
My PHP version is: 8.1

Your problem
My problem is:

Hey guys, i have a VPS server with 3CPU and 4GB ram,
And it seems like the cron of mautic:campaigns:update run it takes a lot of CPU (around 100% when combine with mariadbd):

What does mautic:campaigns:update does, and is there anything i can do to make sure take less cpu (maybe make it run slower somehow)?

Thanks

Reduce your batches a lot, run the cron more frequently. The process takes all that memory and CPU because it loads all that in the memory and then it process it.

1 Like

Thanks for your answer, the cron runs every minute so i can get more frequently.

What does reduce your batches mean? you mean the amount of emails i send in each queue or something else?

I send 200 emails on each queue but i don’t think that what cause the problem.

Yes, try, for testing, 25 or 50 per run (minute)

Thanks, no effect at all,
It’s also camapgin upsate cron so it doesn’t seems related.

My guess is that it connected to segments and amount of users and not the email batch.

Hi!

You can always try to run your cron manually and see if it really finishes in 1 min.

But 3 CPU with 4 GB mem is good for a max 20-30k list, not higher one. Also don’t forget - if you send lot of emails, fast, you’ll have to be able to manage pageviews and email opens.

Joey

2 Likes

Thanks, i have around 7-8k people in the list and only around 3k active (the others unsubscribe).

On my tests i had to limit the contacts to 4000 in the cron and it finish in about 30 sec to run without the contact limit it run for more than a minute.

The problem is coming from this cron mautic:campaigns:update but it seems like i wasn’t able to find a way to make it take less cpu when running (tried to play around with stoping segemnts and campaigns but it didn’t help).

If i reduce the contacts to 2000 the cron run faster and finish in less time but when it run it still take 100% cpu.

Do you have lots of contacts in your campaigns? Inactive ones?
Do you use cache memory?

The campaign with the most memebers has 620 members.

The campaign is really complex and include about 3 months funnel. But even when i paused it the cpu was still 100% when the cron run.

About the cache I have this set “innodb_buffer_pool_size = 512M”

And i am using cyberpanel to control the website but other than that big change i haven’t made more changes.

Uh sorry I’m not sure about cyberpanel. I like to configure directly, cause I have no idea what resources the control panel takes away from the system

1 Like

You are Using cyber panel than I will assume that you are using open lite speed ? ??? Not sure
But if you are using open lite speed sever
I would say this is a some familiar behavior of open lite speed of using higher cpu for some applications.
Not sure why but I end up going back Apache.
Just want to give a hint you if you are using open lite speed
Good luck

1 Like

Thank a lot appreciate that, i am using open lite speed.
I will give it a try and check how it works with apache.

Hello,

Reas this guide from Joey → Ultimate guide to Mautic cronjobs – Joey Keller

It is very helpful.

1 Like