7

After doing some research (Capacity Planning), it appears as if Civi slows down when there are a lot of smart groups or if the smart groups are children of other groups. What should be some good practices to put in place so that the performance/speed of Civi isn't dramatically impacted by a large number of smart groups? Thanks.

3

Do you have a few smart groups on which many others depend? If so it's worth making sure they're as quick as possible. We have a script that generates the important ones once per hour - but by putting the contacts into regular groups, rather than smart groups. Regular groups are much faster, and that speeds things up a bit.

We've also turned off smart group caching. This very much depends on your use-case. But if you have a lot of intermittently-used smart groups it can be better to generate each one as needed rather than have a cron job regularly slow everything down by generating them all. But obviously ymmv on this.

| improve this answer | |
  • We have a mixture of a few smart groups that others regularly depend on and quite a few smart groups that are infrequently run. Is there a way to set up a cron job that only updates certain smart groups (smart groups that populate our website) but does not update other smart groups? Also, we do have smart group caching set at the standard 5 minutes. Is performance impacted by nesting smart groups inside of static groups? – J. Rolfs Apr 7 '18 at 14:47
  • I can't see a way to limit the cron to specific smart groups. But this doesn't seem like it'd too difficult to add. You could put it into the Paid Issue Queue. I would say performance is probably more related to the complexity of the critieria used for the smart group(s) - and how many levels of nesting there are. – Andrew West Apr 9 '18 at 10:27
  • You can refresh a specific group with the contact api - try in the api explorer - you need to pass the group param to the contact.get api – user4278 Apr 10 '18 at 4:32
  • Regarding the cron job to pre-build groups - usually it's a bad idea to run it. Any group that you try to render will be built at that point if not already cached & usually rendering a single group is not too bad (but often one bad group can cause chaos - trying to ping them in turn via contact api can help you find the one making your life miserable) – user4278 Apr 10 '18 at 5:24
  • This is all good information. I'll look into implementing it. I'm currently looking at the list of saved searches and there seems to be quite a few hidden smart groups. Will performance improve if I delete those hidden smart groups or is Civi smart enough to know to not run those searches? – J. Rolfs Apr 10 '18 at 13:42
1

Have you used Smart Group caches? https://docs.civicrm.org/user/en/latest/organising-your-data/smart-groups/#smart-group-caching

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.