Spawn multiple threads during automated backups

Spawn multiple threads during automated backups

by Jeff White -
Number of replies: 3

From how the Moodle seems to work currently is the cronjob running the automated backups only uses a single thread and can only use one cpu core (please correct me if I am wrong). Since most systems now run at least 4-8 course wouldn't it be more efficient for the backup process to start a thread for multiple courses? Lets say start a thread for 4-8 courses at a time? That way the server can use its multiple cores to run the back up process? This is of course assuming the database is robust enough to keep up with multiple backups occurring at the same time. It would be interesting triggering the back up processes on other Apache servers for environments on cluster. 

 

Thoughts? 

Average of ratings: -
In reply to Jeff White

Re: Spawn multiple threads during automated backups

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Moodle is written in PHP which does not have native support for multiple threads.

In reply to Marcus Green

Re: Spawn multiple threads during automated backups

by Jeff White -

Hi Marcus,

I did some quick googling and found thing like pcntl_fork some other methods out there. Would Moodle consider doing things like this or would it wait till a release of php that more readily support multithreading. 

In reply to Jeff White

Re: Spawn multiple threads during automated backups

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

pcntl_fork is not available in Windows and not available in a web environment which would limit its applicability.