catalyst / moodle-tool_lockstats

Moodle cron / task API lock statistics admin tool
https://moodle.org/plugins/tool_lockstats
6 stars 13 forks source link

Table of longest running tasks #7

Closed brendanheywood closed 5 years ago

brendanheywood commented 7 years ago

The recent tasks table is great, but it's also repetitive which can mask other long running tasks. All the duplicated tasks all link to the same page with the complete history so its a little redundant. What we really want is to know what tasks take the longest to run in order. Also showing 134 pages isn't particularly useful. Also it obscures really long running tasks because they don't run very frequently, so a task which is just over the threshold runs often, but slow, and swamps the table.

I'm in two minds about whether this should be a new table, or whether one table can serve both the longest running and the most recent running tasks. Leaning towards merging into one table.

eg showing all tasks by the average run time:

select task,count(duration) count, floor(sum(duration) / count(duration)) avg from mdl_tool_lockstats_history group by task  order by avg desc;

I'd be more inclined to filter this to just the history of the last week so that as improvements are made you get a faster change to the new average runtime. We could still filter it to any tasks whose average runtime is > the configured threshold (eg 300 seconds)

ilyatregubov commented 5 years ago

Longest running task been in code for some time already. Closing