Suggestions for improving performance

Suggestions for improving performance

by Mike Jackson -
Number of replies: 18

We have a school moodle server (1.61) that is beginning to attract more use, but is suddenly slowing down. It is being run on a P1.8 with 2G of RAM. Win 2K3, etc

I would appreciate suggestions on speeding it up. Are there features which cause the database to slow down significantly? User numbers? (we have 1400)

TIA

Average of ratings: -
In reply to Mike Jackson

Re: Suggestions for improving performance

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Some good starting points (in order of easy to hard): install a PHP accelerator, more ram, faster CPU, switch to a Unix-based operating system ...
In reply to Martin Dougiamas

Re: Suggestions for improving performance

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

Note that on a Windows based system a large chunk of your system resources are being used to display a GUI that is very rarely used. If you switch to a Unix based system you get back a huge chunk of resources for doing what the machine is supposed to be doing, serving up moodle.

If you don't have any previous Unix like experience it may seem a steep learning curve, but you can be confident it will be useful in the future.

Also what database engine are you using, i.e. innodb or MyIsam (both MySQL options), I have a suspicion that MyIsam may be faster than innodb. Innodb offers some additional features over MyIsam but they are not used by Moodle.

In reply to Martin Dougiamas

Re: Suggestions for improving performance

by Mike Jackson -

Thanks. I will work on getting some of these taken care of. Is Linux adequate as an OS?

Is there anything that should be done to speed up the database access. Does having old users around matter? Can I just delete users from the user table in MySQL?

 

 

In reply to Mike Jackson

Re: Suggestions for improving performance

by Samuli Karevaara -
I would estimate that removing old users from MySQL has negligible effect, but removing a lot of old log records from the log table (after a backup of the mdl_log table maybe) could improve performance. You could at least try to backup the table, then mark it to have logs for only the 30 last days, and see what happens.

If the issues are significant, I'd say adding more memory is a less problematic way to get more performance than the PHP accelerator.
Average of ratings: Useful (1)
In reply to Martin Dougiamas

Re: Suggestions for improving performance

by Atanas Radenski -

I have seen a couple of messages in moodle.org that mention a possible use of squid as an httpd accelerator. I wonder how much can a squid installation improve performance and what are the trade-offs. I certainly understand that the benefit can vary depending on the installation; yet I hope that there are some generic guidelines/estimates that one can look at before trying squid. Any hints would be appreciated.

In reply to Atanas Radenski

Re: Suggestions for improving performance

by Maik Riecken -

Some words about squid (in poor english...):

A PHP-cache caches php-outputs, but only identical php-outputs. The hitrate of php-caches with moodle should not be to high because any site is delivered individually for each user. You will experience a great performance boost with sites with many simultaneous users using a PHP cache anyway, because of the simple mass of requests. If only 20% could taken from cache you'll save much resources.

Squid can be configured to run in reverse-proxy mode. Squid caches an kind of content (e.g. pictures, soundfiles etc.). Your webserver then works not web-accessible e.g. on port 81. Squid delivers the content on port 80 asking your webserver only when objects are not in his cache. Same PHP-outputs should be taken from squid cache, too, but squid can cache a bigger variety if data.

I found no big difference between  reverse-proxy or a php-cache.

I have got a small machine. We are running 60 Clients simultaneously with a Duron 1200 and 512Megs of RAM. Performance is even fine with the test module.

I am currently using lighttpd as webserver and PHP runs in fastCGI mode with individual user permissions for each moodle installation. If I run in trouble some day, I would try out a additional reverse proxy before moving to another machine.

lighttpd is worth a look for many reasons. My PHP-threads could even run on another machine and loadbalancing is integrated. So my installation is able to scale very well. lighttpd consumes not much RAM either.

regards,

Maik

In reply to Maik Riecken

Re: Suggestions for improving performance

by Genner Cerna -
i've tried reverse proxy in moodle but we had some problems concerning about redirecting to moodle/my and the layout inside the a course is not ok...

anyone has this problem moodle running under reverse proxy? if yes how do i control the refresh rate or cache only image and text...
In reply to Genner Cerna

Re: Suggestions for improving performance

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You can specify what you want/don't want to cache with no_cache directives (plus the relevant ACLs).

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Suggestions for improving performance

by Genner Cerna -
ive tried it and its caching but the theme of moodle seems not to be working well with reverse-proxy
In reply to Martin Dougiamas

Re: Suggestions for improving performance

by Mark S -
I've heard that emptying the mdl_cache_text is the way to improve shared server performance. How do I do this manually? The table is now 74 megs in a small install for 50 part time students which I'm told is a problem. Thanks Mark
In reply to Mike Jackson

Re: Suggestions for improving performance

by Samuli Karevaara -
Monitor the running database queries, memory usage and processor load. Is it always slow or just during busy hours?

About the PHP accelerator: if the database is the bottleneck, I believe that the PHP accelerator won't give enough boost. If it's the processor that is too busy processing PHP, then maybe...
In reply to Samuli Karevaara

Re: Suggestions for improving performance

by Richie Foreman -
If you're using apache, then try decreasing the KeepAlive value to something around the neighborhood of 2-15.  Out of the box it defaults to 15 seconds, and that's way too much for most stuff, by lowering this value you'll reduce the length of time people are connected, and this translates into more available resources.  As other peple mentioned a PHP accelerator can help tons.  Our pages render about 30-40%-ish faster using a PHP accelerator.  Also, perhaps some MySQL tuning as well?

If you want to get really hardcore with it, I recommend a Load Balancing solution. We've got 2 Dell 1850's and a Dell 2850 all in a TCP load balancing configuration.  This doesnt really help with speed much, but it helps with concurencies.

Also, if you have any text filters running inside of moodle you might want to turn off the ones that aren't critical.  In additon if you're using the Chat module, disable it or run it in Daemon mode.

Hopefully that's a push in the correct direction

Oh, and did I mention Debian Linux? wink

--Richie Foreman
In reply to Mike Jackson

Re: Suggestions for improving performance

by Michael Penney -
Sounds like too many users for the machine. Do you have  a budget for server upgrades? It would help in making recomendations to know what your budget for hardware issmile.
In reply to Michael Penney

Re: Suggestions for improving performance

by Genner Cerna -
moodle and reverse proxy is pain in the ass....
In reply to Genner Cerna

Re: Suggestions for improving performance

by Martín Langhoff -
No. Moodle and reverse proxies work great together. Perhaps you haven't configured your reverse proxy correctly, but that's not the fault of either of them...
In reply to Genner Cerna

Re: Suggestions for improving performance

by Rick Boyce -
We've been running Moodle through an apache reverse proxy for a few months now, and the results have been fantastic. Setting it up was very smooth indeed and performance was excellent out of the box.

It actually helped decrease the amount of resources being used at the moodle server - I can only assume that because the moodle server is serving its output straight to the proxy server over a low latency gigabit lan rather than a high latency link (the internet) its using less resources as it doesn't have to spend as long transmitting the data to the client.

Some very early tests seem to suggest that theres a decent peformance gain to be had by caching the moodledata files served through file.php. I need to do some more testing, but that looks like the next project for us smile