Hardware and performance

5s to load any page, and 30s if admin

 
Picture of Nicolas Kouri
5s to load any page, and 30s if admin
 

Hi everybody,

here is my info:

  • Moodle 3.1.4
  • linux / MySQL on a 1 Virtual Server
  • max 50 concurrent users
  • but even if at night, with 1 online user, the speed is the same: 5s for each page load
  • admin user takes more than 30s for any page
  • Theme Designer mode = disabled
  • Legacy log  = disabled
  • users enrolled/login from Active Directory
  • each year, we create automatically thousands of courses, but teachers only use few of them (i know, it's weird/wrong...)
  • so, after 5 years, the database now contains 40.000 courses, but only a few hundreds are used (all others are empty)
  • some tables:
    • mdl_role_assignments and mdl_user_enrolments : 440.000 rows
    • mdl_user : 16.000
    • mdl_user_preferences : 53.000
    • mdl_stats_daily : 9.000.000 rows


Below is a screenshot of our performance test:


performance report

Thank you !

 
Average of ratings: -
Picture of Usman Asar
Re: 5s to load any page, and 30s if admin
Particularly helpful MoodlersPlugin developers

40,000 is a LOT, not that it SHOULD effect your loading time like you mentioned maximum 50 concurrent users, but have you been upgrading/updating your hardware and software with time as 5 years is not a small time frame to keep using the old settings.

rather than attaching screenshot of cache stores, it'll be best if you can tell the allocated hardware resources to VM, which PHP version you're using and also, have you been optimizing your DB?

 
Average of ratings: -
Picture of Nicolas Kouri
Re: 5s to load any page, and 30s if admin
 

Oh of course, we upgraded, now we are:

  • PHP : 5.6.29
  • Hyper-V VM :24gb RAM 
  • 5 V-CPUs
  • and...oups, no, never optimized :/

 
Average of ratings: -
Picture of Usman Asar
Re: 5s to load any page, and 30s if admin
Particularly helpful MoodlersPlugin developers

Upgrade to PHP 7.x, your time and memory requirements will improve.

enable OpCache and it'll be much quicker.

 
Average of ratings: -
Picture of Visvanath Ratnaweera
Re: 5s to load any page, and 30s if admin
Particularly helpful Moodlers
Likely that the automatic creation of courses was not a good idea. (What were they thinking?)

To get an idea, monitor the database traffic when a users logs in, say directly on the "courses" page http://example.com/course/.
 
Average of ratings: -
Picture of Nicolas Kouri
Re: 5s to load any page, and 30s if admin
 

Great, what's the best way to monitor ?

 
Average of ratings: -
Picture of Visvanath Ratnaweera
Re: 5s to load any page, and 30s if admin
Particularly helpful Moodlers
There is no *best* way, without specifying what and for whom? If you are looking for general advice on performance, seehttps://moodle.org/mod/forum/post.php?forum=94.

What I meant with "monitor the database traffic when a users logs in" was to put a debug to the database to write all the queries to a file for a normal user and the admin during log in. (Do that during a low activity time and take it back immediately!) You can then estimate whether those 5 sec and 30 sec are warranted or not.
 
Average of ratings: -
Picture of Nicolas Kouri
Re: 5s to load any page, and 30s if admin
 

ok, done. Most of the queries are " SELECT GET_LOCK('moodle-mdl_-session ... "

Note that we use Database for session handling....is that all the problem ?

 
Average of ratings: -
Picture of Nicolas Kouri
Re: 5s to load any page, and 30s if admin
 

I disabled the database sessions, but same...still slow...

 
Average of ratings: -