"Upcoming Events" block - cause of a very slow load time for admins?

"Upcoming Events" block - cause of a very slow load time for admins?

by Acqua Alta -
Number of replies: 5

Moodle version: 3.8.2

Lately, I was dealing with very slow page load times for Site Administrators in a specific Moodle environment.
I found out that the culprit is the the "Upcoming Events" core block which is present in courses in this Moodle environment. This Moodle environment has a significant amount of user data.

1. It seems that although the "Upcoming Events" block shows a "No upcoming events" message for the admin user, the block causes some heavy loading in the background and therefore  the page load can last 4-6 seconds instead of less than a second. I assume the reason for this is that the admin has an access to all the events data in the course/system, so the query/load takes more time. However, isn't this kind of a bug if this can't turned off somehow? Do I really have to remove this block in order to fix the speed issue for admins?

2. I assume that if while loading a course page I could see in real-time:
* which PHP functions are running
* which SQL statements are running
I could understand more quickly that the "Upcoming Events" block was the culprit. 

I did some search and it seems that in order to view executed SQL statement, there is the following method:
https://moodle.org/mod/forum/discuss.php?d=337187#p1359187

However. I'm not sure about doing the same for PHP. I read about PHP profiling and xdebug, but not sure it's what I need and how exactly to set it up. Could please shed some light on it?


Thanks in advance smile




Average of ratings: -
In reply to Acqua Alta

Re: "Upcoming Events" block - cause of a very slow load time for admins?

by Colin Fraser -
Picture of Documentation writers Picture of Testers
You may be able to get an answer to this in the General Developer Forum, lots of Devs use that more often than they come in here.
Average of ratings: Useful (1)
In reply to Colin Fraser

Re: "Upcoming Events" block - cause of a very slow load time for admins?

by Acqua Alta -
Thanks smile
I wonder if I can move this thread myself to that forum, or I have to copy my message also to there.
In reply to Acqua Alta

Re: "Upcoming Events" block - cause of a very slow load time for admins?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Or to the Hardware and performance forum https://moodle.org/mod/forum/view.php?id=596.

See:
- "block_calendar_upcoming causes substantial login slowdown on large sites with many categories" https://moodle.org/mod/forum/discuss.php?d=427169 and
- "3.9.6 calendar affecting performance" https://moodle.org/mod/forum/discuss.php?d=422644
Average of ratings: Useful (2)
In reply to Visvanath Ratnaweera

Re: "Upcoming Events" block - cause of a very slow load time for admins?

by Acqua Alta -
Thanks a lot, Visvanath.
What's strange is that I'm experiencing this issue in Moodle v3.8.2, and I understand correctly these thread, the problem started after a change was introduced in Moodle v3.9
In reply to Acqua Alta

Re: "Upcoming Events" block - cause of a very slow load time for admins?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
I don't know firsthand. It is possible that the regression was brewing for some time but recognized and treated in the early Moodle 3.9 releases. Another reason for you to upgrade to 3.9 (LTS). ;)

That said, the root cause is probably not yet solved, see MDL-63285 and MDL-72533.

What is the scale of the event calendar of your site?