-
Sub-task
-
Resolution: Fixed
-
Critical
-
2.0.2, 2.3
-
MOODLE_20_STABLE, MOODLE_23_STABLE
-
MOODLE_23_STABLE
-
wip-mdl-27120
-
Backup / restore is performing slowly which is causing many imports to fail for large courses.
In addition to this, an interactive backup/restore/import does not increase max_execution_time, so max_execution_time will remain at PHP's default (which could be something like 60 secs). In Moodle 1.9, both backup and restore would set max execution time to 3000 (50 minutes).
I have also identified 3 major bottlenecks so far in the backup code (see attached profiles for further evidence):
1) base_plan::get_setting() function does a sequential scan lookup to find settings, instead of hash-based, which was very slow and called $setting->get_name() over 1 million times and taking ~30s (see get_setting.png)
2) The various backup_ui_stage classes in backup/util/ui/backup_ui_stage.class.php each contain an initialise_stage_form() method which is using QuickForms in an inefficient way. It calls $form->add_setting() which calls to moodle_form->setDefault which calls QuickForm->setDefaults which fires an "updateValue" even to all quickform elements. So it has n*n complexity (see quickforms1.png and quickforms2.png)
3) The backup_xml_transformer's constructor calls register_links_encoders() which causes an expensive call to get_plugins_list(). The problem is, the class can be constructed 1500+ times during a backup, so it needs a cache! (see getplugins1.png and getplugins2.png)
I have patches for the above 3 issues which I will put on GitHub and link here.
- caused a regression
-
MDL-33630 Invalidate the backup_ids cache on backup_ids_temp table recreation
-
- Closed
-
- Discovered while testing
-
MDL-33428 running 2 parallel backups to the same file seems to run successfully but only displays 1 file for restoring/downloading with under restore page.
-
- Closed
-
- has a QA test
-
MDL-25290 MUC Stage 1: Implement some core caching architecture (MUC)
-
- Closed
-
- has been marked as being related by
-
MDL-29439 Quiz restoration is very slow if the backup contains lots of questions
-
- Closed
-