tj2419 Posted January 28, 2015 Posted January 28, 2015 Hi We have installed Moodle 2.6 last Easter and are constantly getting remarks that it is not as quick as moodle 1.9 (Our previous version). Looking at RAM, CPU usage they are fine RAM about 17% usage and CPU bobbing between 5% and 30%. What else can cause speed issues for moving around moodle? Are there any tips and easy ways to identify where issues could be? Cheers
mrverrall Posted January 29, 2015 Posted January 29, 2015 A few things spring to mind. Firstly have you configured PHP and your Database (I'm assuming MySQL) to actually use the RAM you have? These processes won't just use what you have but will instead will limit themselves to what you've told them they can have in their configs. If you're just running default configs then these values are likely to be low. Secondly you should make sure you have a PHP OpCache enabled, this will store your compiled PHP code in memory rather than hitting the disks and CPU every time a page loads. If you are running php 5.5 or above you can use the built in PHP cache, first check it is enabled by looking at [your_moodledomain]/admin/environment.php, and then make sure it is configured properly (PHP: Runtime Configuration - Manual). If you're running PHP 5.4 you should look at PHP APC as a Opcache (PHP: APC - Manual). You may also want to further limit your disk I/O by setting up a ramdisk for Moodle disk caches, check out the config options here for moodle here: Official Moodle git projects - moodle.git/blob - config-dist.php. You'll loose the content these folders on a reboot so make sure you only use them for cache folders. Further tweaks may include, X-Sendfile, memcached for sessions, hardware optimisations for disk IO (e.g. raid configuration, read/write cache rations etc), and probably a bunch of things I've forgotten. Most of this is just standard web/database server administration and not Moodle specific so don't get bogged down looking for advice on 'slow Moodle', look at your services in general, look for bottlenecks and see if there are solutions 1
tj2419 Posted January 29, 2015 Author Posted January 29, 2015 Hi thanks for such a detailed reply. I'll get looking into these. Just a query about your first paragraph. Would that be configured in the php.ini file? Or somewhere else? Many thanks
tj2419 Posted January 30, 2015 Author Posted January 30, 2015 Also if anyone has a link as to which values to change that would be great thanks. I have 16GB RAM installed but don't know where to tell it to use it all. Cheers
mrverrall Posted January 30, 2015 Posted January 30, 2015 (edited) For the php.ini it would be the memory_limit value. However on reflection this would not be an issues unless you have actually run into actual errors so you can probably leave this alone. One value you should definitely change though is the 'realpath_cache_size' as this will help with php's handling of the large number of files included in moodle. A value of 1M should be plenty (the default I think is only 16K). The big win for PHP will be in implementing the Opcache. I use APC and as Moodle is quiet large I find I need an apc.shm_size of ~410M to contain it comfortably. This gets pre allocated as a block of memory regardless of if it's used and so won't be available to other applications. You will want to keep this value as just-enough to stop the cache filling and purging (which it will do when it gets full). As for MySQL I'm not going to be much help as I tend to use PostgreSQL where I have a choice. When I do have to work with MySQL I use a tool like MySQLTuner-perl by major to guide me; unfortunately that tool is Linux only but you might be able to find an equivalent for Windows if you do some Googling. One principal that is sure to apply though is that it's not going to be as simple as telling it to 'use all the ram' and you almost certainly won't want it to. It's generally best to set up your daemons to use just enough ram to get their job done efficiently and will not be a one size fits all (unfortunately). Something else I forgot to mention is to check that your HTTPD (Apache, ISS or whatever you are using) is handling your connections efficiently, You want to be able to accepts enough connections and to be able to folk enough php workers to accommodate them, otherwise it may be queueing requests. Edited January 30, 2015 by mrverrall 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now