Mautic Community Forums

Mautic:segments:update Question

Your software
My Mautic version is: 4.1.1
My PHP version is: 7.4
My Database type and version is: mariadb 10.3

Your problem
My problem is:

We are running an extremely high traffic site with 1000+ visits per hour and are running into latency issues with segment update.

Example we have a campaign that is based on anonymous users hitting a certain page. This campaign is based off a segment that captures anonymous users. The problem is inside Mautic we also have 80+ segments some of which are a few hundred thousand users.

So what is happening is that this aparticular segment is actually taking around 10 minutes to update which rendors the focus item campaign useless.

Now I can go ahead and use Mautic:segments;update -i [segment id] to run specific segments that take very long only once a day for example, but this means that for my cronjob that is running every minute * * * * * php /var/www/mautic/bin/console mautic:segments:update will update all segments, is there a way to do a "negative here " ?

I mean we are running a pretty strong server with 32GB RAM, 8 CPU, and still taking forever to update segments

Hi, not sure about available options in command, but one simple solution I can think of is to categorize segments by priority and then always use mautic:segments:update -i based on how freaquent specific category needs to be you then create cron job entry.

What I would do (assuming there is no suitable option with the command itself):

  • Crreate a list of segments in Mautic and to each segment I would specify how often it needs to run (this can be csv file)
  • Create a python/bash script that read this file, looks when segment update was last ran and then check it against how often ti needs to run (data in csv file)
  • If it needs to run then within bash script I would run segments update for that specific segment
  • If not you just skip it and move to next entry on the list

If there is no mechanism within the command (and I do not recall it at the moment) this might be a good feature request.

I hope its clear what I am tried to describe. Hope it helps.

Regards, M.

Yes, this is basically what I do within crontab itself, I land up having around 30 different lines for update segment. It would be much easier if there was a flag like to exclude certain segments rather than to just run a specific segment.
Also my understanding of the -I flag is you can only allocate one segment to this,

If we go even fruther we can do in a way that this “frequency for cronjob” is stored alongside each segment and then you only need to run mautic:segments:update and it would read config from database.

This way the whole setup for segments is in one place.