requirejs timeout config, and pluginfile advice

requirejs timeout config, and pluginfile advice

by Michael Ko -
Number of replies: 2

Hi all,

We have a few problems with our site (3.0.2 - will upgrade to 3.2 soon, on 3 load balanced web servers, one containing the moodledata share point)

Is there any particular reason that the requirejs timeout is hard-coded as 7 seconds (it is also non-configurable and I had to "hack" it to increase it to 50 seconds)?

In many of our quizzes, the first.js file called by requirejs does not even begin to load after 7 seconds (and the timeout error occurs), because hundreds of images are still loading. The pluginfile.php files are particularly slow, in comparison to images that we store in a separate folder and bypass the pluginfile.php mechanism. We have already divided the quiz into many pages, and reduced file sizes as much as possible. First.js does not time out in other pages, or smaller quizzes.

So I have 2 questions:

1. Is there any way that pluginfile.php can access images from the moodledata directory, without relying on one shared point? Can performance be improved, or pluginfile.php be disabled completely?

2. Isn't it a bit dangerous to assume that a 7 second timeout is perfect for all websites? Especially when people have slower internet connections, I can imagine lots of javascript errors would occur.

Thank you.


Average of ratings: -
In reply to Michael Ko

Re: requirejs timeout config, and pluginfile advice

by Virgil Ashruf -

I think you are going to be helped much more with this configuration directive:

https://docs.moodle.org/26/en/Server_cluster#.24CFG-.3Elocalcachedir

You will be able to add folders to the local filesystem of each webserver. And each webserver will then populate that folder with local cached files; this will speed up loading javascript, theme and language files tremendously

Also I advise you to look into a shared cache for application data. We're currently very happy in using Redis as our solution since it was embedded in 3.1 and up. You can also use this for session caches.

Average of ratings: Useful (1)
In reply to Michael Ko

Re: requirejs timeout config, and pluginfile advice

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

You can consider to upgrade to the latest 3.0.x at least (which should be safe). In 3.0.6 the requirejs timeout issue was addressed - see MDL-55312 for details.