0

apologies for the newbie nature of this question .. I am a web developer though don't have too much experience maintaining servers or debugging and fixing performance issues.

I have a Moodle site (Moodle 2.2.3) running on an Apache server (LAMP stack) that uses a MySQL database.

Recently, when certain users try to log in they have been reporting a timeout - they simply see a blank page after a given time. Some users are able to log in fine. This appears to be determined by which courses the user is enrolled in. An admin user with no courses for example can log in fine.

I have been able to extend the timeout value in php.ini from 60 seconds to 120 seconds and see the same behaviour. Using $top I can see that the CPU used by www-data spikes around 99% until the timeout kicks in.

I am assuming there is a long call to the database being made, or similar.

How can I see error messages logged by mysql? how can I see error messages logged by PHP? The default error_log (/var/log/php.log) which is defined in my php.ini doesn't appear to be there? How can I get PHP to log errors to this file so I can see whats happening?

Moodle also logs errors to logs/error.log but this doesn't shed any light on things.

All and any good suggestions welcome - thanks!

undefined
  • 654
  • 2
  • 8
  • 18

1 Answers1

0

We did a lot of Moodle performance optimisations where I used to work and used PHP Xdebug profiling to help out with a lot of it. By enabling profiling, it will produce a *.cachegrind file which is then readable by many readers - I use QCacheGrind on Windows, or KCacheGrind on Linux. You should then be able to pinpoint the function which is taking its time.

From memory, it is probably the amount of course data that it's trying to load when the user logs in. If there is too much data, and it's grabbing all of the data from the SQL server rather than only whats necessary, this could slow things down quite a bit. This can also be identified using the slow log as mentioned in a comment above, providing that its the SQL query that's causing the performance issue.

I would also definitely advise upgrading your Moodle instance to something newer as I know there were a lot of performance fixes pushed across to the upstream repository since Moodle 2.2.3. We used to push these over to Moodle as an official Moodle partner.

jaseeey
  • 1,462
  • 16
  • 20