Slow Load Time When Saving a new Activity or Editing an Existing one

Slow Load Time When Saving a new Activity or Editing an Existing one

by Ahmed Aly -
Number of replies: 6

Hey Everyone,

I'm sorry for the long post, but this issue is driving me crazy and hope someone could help me with a solution.

I'm administrating our company's Moodle from the Front end side, and we are having and issue with one of our Courses, where the issue in this particular Course, the slowness when anyone attempts to create any activity such as Quizzes.


What happens exactly is, when you attempt to create a quiz, the webpage load the Quiz settings forum, and once you finish customizing it, and chose either save or save and return to course, the page hangs and keeps loading, for almost 1 minute "give or take" until the activity is saved. this issue also happens when you try and edit the quiz setting for example or editing any questions content and any other activity.

Also worth noting that this issue is only present if your attempting to add or editing something, but if your a student who's answering a quiz or attending to a survey, you wouldn't feel any performance issues.


This issue is only available in one of our courses, the reset of the courses are not effected. however the effected course is highly populated with content, where it contains over 4 surveys and one of them have almost 15000+ responses alone, not to mentions over 60 to 70 quizzes with a question banks that contains over 1500 questions and a few uploaded videos.

I thought this issue might be related to PHP memory limit, since we faced a similar issue last year, where our questionnaire didn't load it's content duo to a limited memory that was allocated to PHP, the allocated memory Was 128MB and we increased it to 256MB, and everything worked fine after that.

I thought this time that the page load time is related to a limited memory duo to the available amount of data within the course, So I have contacted our IT team who handles our Moodle back end side , and asked them to increase the PHP allocated memory from from 256MB to 1024MB and reboot the web server. However the issue wasn't resolved sadly. Our current Moodle Version is 3.0.2.

so now i'm kinda stuck and i'm not sure how to track this issue and solve it.

Yours,

Ahmed

Average of ratings: -
In reply to Ahmed Aly

Re: Slow Load Time When Saving a new Activity or Editing an Existing one

by Ken Task -
Picture of Particularly helpful Moodlers

Two other places to look into for 'slowness' ... a site your size would probably have a dedicated DB server that is remote to the site.   If running Linux (RHEL/CentOS/Ubuntu) suggest installing MySQLTuner.pl on the dedicated DB box.   Run it.

You might find database is in need of tweaking ... just like you've done for PHP.

If the Activity involves uploading of a file or linking to a file that wasn't present before the edit/creation, that could mean a bottle neck with moodledata/filedir ... where the files are stored.   If moodledata is on a network file system, checking into the networking between the code server and moodledata on the NFS is in order.

Those 2 are guesses as some additional information about the moodle set up has not been shared (devil many times is in the details) like:

Operating system, PHP version, MySQL version ... and if load balanced or not, etc..

Can say this ... moodle 3.0.x is old ... in need of an upgrade.  Your PHP version can be a 7.0.x but the version of Moodle you are running I don't think can be run under 7.1 of PHP.

'spirit of sharing', Ken

In reply to Ken Task

Re: Slow Load Time When Saving a new Activity or Editing an Existing one

by Ahmed Aly -

i will check with our IT team about our Moodle Server configuration, in order to have a clear idea about our current installation and wither we are hosting our entire installation on 1 server or more and if our installation is load balanced or not.

concerning the MySQLTuner.pl tool , if our IT team run it, what are they supposed to look for once the tool provides it diagnostics ? anything in particular i should inform them to look for ?

as for our system info:

  • Our OS is CentOS.
  • PHP versions is 5.6.17
  • MySQL versions is 5.5.46
Upgrading our Moodle installation from the 3.0.x to something higher is definitely something I'm looking at, however it may take some time to pull it off, since it needs to tested on a separate server to make sure every plugin we are using is working fine without any issues.


In reply to Ahmed Aly

Re: Slow Load Time When Saving a new Activity or Editing an Existing one

by Ken Task -
Picture of Particularly helpful Moodlers

Tuner will show sections of metrics ... **example** clips follows (from a CentOS 6 server running MySQL 5.5.59 and a 3.1.13 of Moodle on a standalone ... ie, web interface (moodlecode) and DB server on same machine.

7895 active users. only 33 courses but 4 of those have been running since server has been up on the net.

-------- Performance Metrics

[OK] Maximum reached memory usage: 2.1G (27.10% of installed RAM)
[OK] Maximum possible memory usage: 2.5G (32.13% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available

-------- InnoDB Metrics

[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 2.0G/698.4M

At the end:

-------- Recommendations

which should be investigated and if OK in environment, applied.

It is hoped one of the members of your IT team is familiar with MySQL DB administration.

And this might move the plan to clone the site for testing purposes along.   Install tuner on the clone and run it.  Make the recommended changes.  Restart the MySQL server.   Wait about a day for DB server to collect usage/other information.   Run Tuner again.  But do understand, the clone won't have daily usage like production.

Know your IT people are busy, but sometimes acting as a 'middle person', leads to some mis-understanding, etc.  Consider asking one of your IT people to sign up for these forums ... they then can communicate directly and decide what technical information can be shared securely.

'spirit of sharing', Ken

In reply to Ken Task

Re: Slow Load Time When Saving a new Activity or Editing an Existing one

by Ahmed Aly -

okay a small update, after communicating with our IT team, they provided me with our current Moodle installation details and here it is:

Moodle is deployed on Virtual Machine based on (Microsoft hyper -V):

provided specs is :

  • OS is CentOS 6.5
  • CPU: 4 Cores
  • RAM: 4 GB
  • HDD: 400 GB

Not the best Specs sadly for a corporate us , also it means that our DB is located on the same server which hosts the rest of Moodle data.

I haves contacted our developers team, in order to reach someone who's experienced with MySQL DB, and after showing a demo with where i created a quiz on a populated course and a less populated course. the speed difference was clear and he agreed that that the issue might be related to our DB performance. and he will support us to try and optimize it for performance.

we should start soon thought, once i receive the required username and password to access the DB.

I also requested from our IT team to provide me with server performance log to take a look at it performance for any issue potential issues or bottlenecks.


In reply to Ahmed Aly

Re: Slow Load Time When Saving a new Activity or Editing an Existing one

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

When you add or edit an activity in a course, Moodle has to clear the 'modinfo' cache for that course, and then that information has to be rebuilt, which is slow (which is why it is cached!)

As a test, try going to Admin -> Plugins -> Caching -> Cache administration (I hope I got that path right). Find the 'Course modinfo' cache on that page, and click the 'Purge link' next to it. Then try visiting the course. If it is slow, that confirms that this is the problem.

(In addition, you could first turn on Admin -> Development -> Debugging -> Show performance information. That might give you some clue what Moodle is doing when it si being slow.)

Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Slow Load Time When Saving a new Activity or Editing an Existing one

by Ahmed Aly -
I'm a bit worried to try it out since, I'm not sure what the outcome will be once i clear the course cached data.

Issue is i really don't have an images from our current Moodle installation to work and test it on separate isolated server, and i'm avoiding doing some major changes on our production site.

some questions that comes to mind,
  • what if i cleared that cached data, how long dose it take to rebuild it cache again?
  • And will people notice a saver performance hit once the course module starts to rebuild it cached data from scratch ?
also if i visited the course, once i purged the coursemod info cached data, and if it slow, what the solution will be ? right now we are suspecting that the issue might be related to our DB being less optimized for large data structure which might have cased this performance hit on our populated courses, we are still checking out with our development team, since they have experience with MySQL administration and creation. and hopefully we will be able to see how the DB is looks like once we get our hand on the required username and password to access it.