3

I have a site with around 4000 pages which is using fine grained permissions on around 400 of those pages. For some users accessing the /admin/ page the page loads in a second or so. For others the page can take around 5 minutes to load.

Profiling and debugging into the code seems to show that the area of concern is the wagtail\core\models.py explorable_pages() function, in particular the

page_permissions = Page.objects.filter(group_permissions__in=self.permissions)

line. This seems to return, for my data at least, over 2000 results with each reults repeated 6 or 7 times (returning a result for each permission type?). There are only around 400 distinct results.

Adding a distinct() improves matters

page_permissions = Page.objects.filter(group_permissions__in=self.permissions).distinct()

getting the number down to around 400. My page loads are now around 90 seconds - not ideal but better.

Is the above a real issue with wagtail or am I missing/not understanding something?

Is there something I can do to speed up the page loading? Are the site permissions being set in a way that would be expected for a typical wagtail site?

(Excuse my ignorance and I am probably using the wrong terminology - I am Java programmer new to Python/Django/Wagtail)

pillingworth
  • 3,238
  • 2
  • 24
  • 49
  • 2
    This sounds like something we should address in Wagtail itself. Would you mind raising an issue at https://github.com/wagtail/wagtail/issues/new/choose ? In the meantime: "Are the site permissions being set in a way that would be expected for a typical wagtail site?" Probably not - I haven't seen this behaviour in the 50+ Wagtail sites we've built. Can you say more about how your permissions are set up? – tomd Feb 11 '21 at 12:33
  • Have done that. I think there's room for tweaking the code but fundamentally the issue is the sites permissions. I have removed all the child page permissions and pushed these to a higher level page and that seems to have sorted the issue. – pillingworth Feb 12 '21 at 13:31

0 Answers0