Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sites with large numbers of cohorts cannot load settings page, very poor performance #842

Open
matthewhilton opened this issue Apr 24, 2023 · 0 comments

Comments

@matthewhilton
Copy link

matthewhilton commented Apr 24, 2023

Description

  • When installed on a site with a large number of cohorts, the plugin does not efficiently query them in the plugin settings, leading to very poor performance.
  • Performance issues are across most site administration pages since moodle tries to re-query the settings
  • The site in question has 165,652 cohorts
  • The actual xapi settings page tries to make a checkbox for each cohort. This takes ages to load each checkbox and is more or less unusable, and likely will crash browsers on lower spec machines

Version

  • master at 416b92cfd672e02e1c92b5011ee6395bb95a5111 on 2022101800

Steps to reproduce the bug

  1. Enable profiling via site administration
  2. Create a large number of cohorts
  3. Profile the admin search page https://site.com/admin/search.php?PROFILEME=1
  4. Check profiling run. In this site, the profiling run shows the following trace taking a large chunk of time:
admin_get_root
core\plugininfo\tool::load_settings
tool_log\plugininfo\logstore::load_settings
logstore_xapi_get_cohorts

The logstore_xapi_get_cohorts step takes ~10 seconds of execution time.

Expected behaviour

  • Plugin does not impact site performance unnecessarily

Actual behaviour

  • Admin page takes > 10 minutes to load.
  • It tries to make a checkbox for each cohort. If I let it run, it tries to make 100,000+ checkboxes.

Server information

  • Postgresql
  • Moodle 4.1
  • OS: Linux

I would recommend using recordsets to get the data, and refactoring the settings page to use a search/autocomplete box with multi select option.

@matthewhilton matthewhilton changed the title Performance issues in site administration Sites with large numbers of cohorts cannot load settings page, very poor performance Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant