Hardware and performance

 
 
Picture of Biel Frontera
Workaround to load files without file.php
 

Hi,

I manage a small installation of moodle 1.9 in a shared hosting. The performance is very poor, even if there are few users logged in.

I've done this workarround to improve the performance. I avoid file.php execution to serve some files:
- New folder named 'public' inside course files
- New folder named 'moodleimages' inside root server.
- Symbolic links from moodleimages/course_id to moodledata/course_id/public
- htaccess redirection:

RewriteEngine On
RewriteRule ^file.php/([0-9]+)/public/(.*)$ /moodleimages/$1/$2 [QSA,L]

Now, teachers leave all the stuff that they don't need to be private inside public folder. And htaccess does the job to serve the file as static, without calling file.php. We have some courses with > 20 images among all chapters summaries, and now, are shown immediatly.

What do you think about this solution? What other actions do you recomend? (We are planning to migrate to a VS in a month).

 

Biel

 
Average of ratings:Useful (2)
Picture of Visvanath Ratnaweera
Re: Workaround to load files without file.php
Group Particularly helpful Moodlers
Hi

You wrote:
> I manage a small installation of moodle 1.9 in a shared hosting. The performance is very poor, even if there are few users logged in.

What 1.9.x exactly? The later versions of 1.9 (> 1.9.10) were highly streamlined. 1.9 is the most efficient Moodle version still maintained. If your shared hosting has problems with it even when
only few users are logged in, there is a problem somewhere. Could you post some measurements of its performance? The methods are described in the performance documentation.

> I've done this workaround to improve the performance. I avoid file.php execution to serve some files:
> - New folder named 'public' inside course files
> - New folder named 'moodleimages' inside root server.
> - Symbolic links from moodleimages/course_id to moodledata/course_id/public
> - htaccess redirection:
>
> RewriteEngine On
> RewriteRule ^file.php/([0-9]+)/public/(.*)$ /moodleimages/$1/$2 [QSA,L]

Very interesting. There may be a connection to this idea: "Using X-Sendfile to serve files in Moodle" https://moodle.org/mod/forum/discuss.php?d=217355. Not known to me otherwise.

> Now, teachers leave all the stuff that they don't need to be private inside public folder. And htaccess does the job to serve the file as static, without calling file.php. We have some courses with > 20 images among all chapters summaries, and now, are shown immediately.

Again some measurements are needed. It is a bit tricky with images though, because they get cached in many places.

> What do you think about this solution? What other actions do you recommend? (We are planning to migrate to a VS in a month).

If the work flow and sharing a common pool is OK for your teachers, why not? The only reservations I can think of are:
- Moodle 2 will most likely to break this
- The new server (VPS) might behave differently, different bottle necks for example.
 
Average of ratings: -
Picture of Simon Story
Re: Workaround to load files without file.php
 

Hi Biel,

In Moodle 2.3 a feature was added to lighten the load of serving files. Andrew wrote about it here: https://moodle.org/mod/forum/discuss.php?d=217355 .

Regardless, if it slow with only a few users, it's gonna be slow anyway. A good virtual server will be an improvement.

 
Average of ratings: -