How do I find the "largest" course? query?

How do I find the "largest" course? query?

by Jerry Lau -
Number of replies: 5

Hello folks.

How or where in moodle could I find the "largest" course? I want to try and run the load test on it to see if our new platform specs could improve on response time with our new setup.

Is there a query for this? Just need the top 5 say.

running moodle 3.4.x, rhel 7.5 64-bit, moodle app 16 gb ram, MySQl 5.7.21 db server with 16 gb ram, php 7.1.8 & apache 2.4 build august 2017

thanks


Average of ratings: -
In reply to Jerry Lau

Re: How do I find the "largest" course? query?

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Your backups should help you here, Jerry, I would think. If your cron runs and backs up your courses have a look at the file sizes. I suspect that you are looking for the largest course with the most activity, that is complete with all Users and their uploaded work? The absolute largest course, in terms of resources and activities but with few Users may not have much activity in it, whereas a smaller, in the same terms, course with a lot of users and plenty of activity may suit your need better.    

In reply to Colin Fraser

Re: How do I find the "largest" course? query?

by Jerry Lau -

I can do both I guess but how do I test for most "activities" and get the courses that are in the list?

In reply to Jerry Lau

Re: How do I find the "largest" course? query?

by Ken Task -
Picture of Particularly helpful Moodlers

IF you have course backups of all courses, query the mdl_files table for .mbz's and include filename and filesize in output.

There's a plugin ... course size

https://moodle.org/plugins/report_coursesize

OR ... install moosh

It has a switch to the command for 'course-info' which when run on a course id produces info which can be redirected to save to a text file.  Note the total file size info (**) in example below and the real size of a backup ... also **  

Example output (real course on real server):

moosh -n course-info 3

3    Installing Moodle Solr SLinux 6 or CentOS 6 or CentOS 7    SLCENTOS
Course ID in que: 3
Course ID: 3
No of contexts: 28
Context by level:
    CONTEXT_MODULE (70):    23
    CONTEXT_BLOCK (80):    5
Context by module:
    chat (4):    1
    forum (9):    1
    label (12):    2
    page (15):    8
    resource (17):    10
    lightboxgallery (23):    1
Number of role capability overwrites: 0
Role capability overwrites by context:
Number of local role assignments: 0
Locally assigned roles by context:
Number of enrolled users: 3
Users enrolled by role:
    editingteacher (3):    3
Number of groups: 0
Group statistics:
    Min number of members in a group:    0
    Max number of members in a group:    0
    Avg number of members in a group:    0
Course modinfo size: 48410
Number of sections: 4
Section statistics:
    Sections visible:    4
    Sections hidden:    0
    Min number of modules in a section:    1
    Max number of modules in a section:    12
    Avg number of modules in a section:    5
Number of grades: 0
Number of log entries: 151
Number of files: 26
Total file size: **1172849**
Cache build time: 0.036876916885376

It also is a little off:

ls -l /home/backup/m32/backup-moodle2-course-3-slcentos-20180521-1738.mbz
-rw-rw-rw-. 1 root root **2348973** May 21 17:38 /home/backup/m32/backup-moodle2-course-3-slcentos-20180521-1738.mbz

But, moosh does give other course info.

'spirit of sharing', Ken


In reply to Ken Task

Re: How do I find the "largest" course? query?

by Jerry Lau -

Thank you Ken.

I did think about rewriting my query based on course backup size but that may be misleading as there may only be say 3 users but lots of resources LOL