Thursday, October 08, 2026

interesting results with 60 Moodle users logged in

One of our Ubuntu servers hosting Moodle instances had been bumped from D2asv5 (8 GB RAM) to D32asv5 (128 GB RAM) anticipating 100+ users for a training event. Interestingly, even with 60+ users logged on simultaneously, RAM usage did not cross 8 GB. So, tried using D4asv5 (16 GB RAM) for this standalone server, and then tried even not bumping it up from D2asv5. But with D2 (2 cpu cores), the CPU was continuously pegged at 100%, with load average going up to 15. Probably better to bump up to D4. Logging was via https://github.com/hn-88/log-memory-cpu-usage as mentioned in the previous post, and emails being sent to me similar to this - https://hnsws.blogspot.com/2021/02/scripts-to-alert-admin-when-hard-disk.html

(for my reference, conversation with Gemini to find the number of logged in users - and what they were doing - is at https://aistudio.google.com/prompts/1rp43v9LvY7d-b6pk82fgF0dDVQPWmJh8 )

Suggested database queries were - 

SELECT COUNT(DISTINCT l.userid) AS unique_users_active
FROM mdl_logstore_standard_log l
WHERE l.timecreated BETWEEN [START_UNIX_TIMESTAMP] AND [END_UNIX_TIMESTAMP]; 

to find the number of logged in users, and to see what they were doing, 

SELECT 
    u.username, 
    u.firstname, 
    u.lastname, 
    FROM_UNIXTIME(l.timecreated) AS time_of_action,
    l.eventname, 
    l.component, 
    l.target
FROM mdl_logstore_standard_log l
JOIN mdl_user u ON u.id = l.userid
WHERE l.timecreated BETWEEN [START_UNIX_TIMESTAMP] AND [END_UNIX_TIMESTAMP]
ORDER BY l.timecreated ASC;

Edit: Digging deeper, the limited RAM use is probably due to the MaxRequestWorkers setting in Apache settings as per https://docs.moodle.org/503/en/Performance_recommendations#Apache_Performance

No comments:

Post a Comment