/mod/quiz/view.php progressively slower

/mod/quiz/view.php progressively slower

by brian shore -
Number of replies: 1

I have a v2.4.0 instance with a small course and quiz. The quiz has 6 questions, submitted together. Every time I submit the quiz, the view.php page gets slower. It started at around 3--4s, it's now up around 2 minutes, with the quiz submitted maybe 15 or 20 times. The page is so slow now that it times out, so I can't check the exact count.

I've looked at xhprof runs for this page, and I see the database query functions (oracle: oci_fetch_all, oci_execute being particularly bad) being called insanely many times for a single page load -- 20,000 calls or more. And this count has increased with each quiz submission as well. According to xhprof, these two functions consistently contribute about 80% of the time this page (script) is running.

Has anyone seen anything like this? How do I diagnose the cause of all these function calls? I can't imagine that moodle really needs to make 20,000 queries just to load the page that shows the table of previous quiz submissions...

I've looked over the performance settings and recommendations pages, only the bit about logs seems relevant.  The current log table is a few MB and has only 8000 rows or so.  I set a limit of 2 days in the cleanup settings, but most of these records were generated within the last 2 days anyway, and 8000 records doesn't seem very large.

TIA

--

bks

Average of ratings: -
In reply to brian shore

Re: /mod/quiz/view.php progressively slower

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

What you are seeing is definitely neither normal nor right.

I am guessing that this is some Oracle-specific bug. We need to know what exactly those DB queries are. Actually, I wonder if you are hitting the issue Martín Langhoff identified a long time ago:

Really, if you can run Moodle on anything other than Oracle, you should. I would always opt for Postgres.

Note that there were some performance issues with 2.4.0, so if you can upgrade to 2.4.5, you should. However, those issues were nothing to do with the quiz module. (See https://moodle.org/mod/forum/discuss.php?d=227745 for details.)