Restoring courses is slow, php settings advice

Restoring courses is slow, php settings advice

by Rick Jerz -
Number of replies: 7
Picture of Particularly helpful Moodlers Picture of Testers

I am doing a full restore of one of my courses.  I gave it a half-hour, and Moodle did not complete the restore.  This made me wonder what php settings, if any, need to be tweaked in order to improve the restore speed?

Also, I saw that restoring a course puts a load on my small server.  Are there any mySQL parameters, or any other Moodle parameters that I need to adjust?

 

Average of ratings: -
In reply to Rick Jerz

Re: Restoring courses is slow, php settings advice

by Ken Task -
Picture of Particularly helpful Moodlers

Think I'd try to find out why it failed first.   If on a remotely hosted system (even a GoDaddy VPS) there are caps/limits built into those.  Example, you probably cannot increase the memory allocated to the guest operating system you are running.  Package purchased might be 4 Gig and that's what you have to work with, unless the provider has something larger - for more $, of course.

Any error in the apache error log? ... like exceeded?

With whatever tool you have to browse files, go to moodledata/temp/backup.   Incomplete backups might leave a directory with a long name: d7999b27a328232a877b99360ca5c5af

There might be a long filename.log.  It's a text file.  Open it to view what it says.

is there a longfilename.mbz file there?

Change into directory and list the files long recursively: ls -lR

See if there is a moodle_backup.xml present.

Could be that your host had enough time to build it, but since Moodle uses the cp command rather than mv to place the backup in filedir could be that's failing.

As far as what tweaks ... would think increasing the time a script can run and maybe even the memory a script can use.

'spirit of sharing', Ken

In reply to Ken Task

Re: Restoring courses is slow, php settings advice

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Ken, thanks for your reply.

I used "top" to monitor my VPS and did not notice that I was running out of memory.

I went to moodledata/temp/backup, and test, I see several long directory names.  The "log" files have 0 bytes.  No longfilename.mbz anywhere.

Yes, I cd'd into one of the long directory names, and yes, there was a moodle_backup.xml present.

Before I try another restore, can I delete all of these files in moodledata/temp/backup, so that I can see what might be new?  I never mess with moodledata directory, but is it safe to delete these /temp/backup files?

Also, I saw that my php.ini setting for max_execution_time is = 600.  Might it make sense for me to bump this up a little, like to 900?

What I notice is that the course restores, but just doesn't finish with all of the topics.  I get around 12 out of 18 topics restored.  So it seems like it is just not finishing.  I waited 30 minutes, but maybe with the execution time at 600 it is stopping after 10 minutes.

In reply to Rick Jerz

Re: Restoring courses is slow, php settings advice

by Ken Task -
Picture of Particularly helpful Moodlers

Can remove all files/folders contained in moodledata/temp/backup/ manually.

If running out of memory is the problem, apache error logs should say something about that.  Check.

Your guess is as good as mine on increasing max_execution_time.  However, can't help with running out of memory.  You might have to put your site in maintenance mode before running any backup of courses.

Since you have access to shell (and use it) one could do this:

cd /path_to_moodledata/temp/backup/

watch 'ls -lR'

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Rick Jerz

Re: Restoring courses is slow, php settings advice

by Guillermo Madero -

Hi Rick,

It sure sounds like a time limit. Try by increasing the value of the max_execution_time and max_input_time directives:

max_execution_time = 1200
max_input_time = 1200

Average of ratings: Useful (1)
In reply to Guillermo Madero

Re: Restoring courses is slow, php settings advice

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Guillermo, I will give this a try first to see what happens.  I am also going to take Ken's advice and look more closely at memory usage.

It may take me awhile to try this because I am working with my production server, and I don't want to disturb the current students.  I usually wait until a morning when I wake up very early.  smile

Thanks much.

In reply to Rick Jerz

Re: Restoring courses is slow, php settings advice

by Guillermo Madero -

Hi Rick,

Yes, better be safe with that production server Yes.

As some restore problems tend to be quite difficult to solve, for one reason or another, one way to deal them is by setting up a local Moodle installation and do the restore there; then, instead of doing a monolithic backup, one can divide the backup into two or more parts. One would then restore the first part as a new course, and the rest as merges.

There are other way to restore problematic backup files, but they are a bit more convoluted.

--- edit

By the way, if increasing the value of those directives allows you to restore the course, just remember to set them back to the original values once your restores are done. As usual, the web server will have to be restarted.

In reply to Guillermo Madero

Re: Restoring courses is slow, php settings advice

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

I have made the directive changes and rebooted my server.  Now I am waiting for a good time to try a restore (can't today, I have an exam going on).

I too thought about resetting these particular directives.  If I leave them set high, I suppose that some other process could run for 20 minutes before quitting.  Probably not a good idea.  Is this your main concern for you recommending to reset them?