Hardware and performance

 
 
Picture of JD Moodle
Improving the performance of quizzes
 

Just a heads up.

I use the quiz as a formative "bell work" exercise every day.  Forcing students to enter a password before starting the quiz is slightly annoying to them, however it has saved 50% of my resource points (CPU/RAM) on my shared hosting service.

Now all students cannot start the quiz at the same time because of various typing speeds.

My hosting service computes a CPU/RAM metric they call resource points.  They don't care about bandwidth or harddrive space, it's CPU/RAM that they are strict on.  You can see the drastic effect on ensuring that all 30 of my students don't press the ATTEMPT QUIZ button at the exact same time.

Passwording Quiz helps save the server.

These daily quizzes are set as ADAPTIVE WITH NO PENALTIES, so that means every question has a CHECK button that they can click.  I wish Moodle had a built in anti-spam technology to stop a frustrated student from repeated smashing the button, but it seems the stopping the quizzes from launching at the exact same time is the cure.big grin

 
Average of ratings: -
Picture of sam marshall
Re: The quiz function of moodle 2.3.2 seems to put quite a strain on a server
Group DevelopersGroup Particularly helpful MoodlersGroup Testers

Wow!

By the way, this is just a thought and I don't know how it really would work, but seeing these results put it into my mind: would it be possible to simply limit the number of requests the webserver handles concurrently, as another way to solve this problem? That way students will experience varying delays as the webserver waits until a slot is available, instead of having to actually type a password in.

This could appear more like a system problem as it may result in slow responses. But it seems to me you're basically doing the same thing, only manually, by forcing them to type a password. Getting the server to do it would also reduce the delays to the amount actually required in order to ensure consistent performance, rather than a random amount based on typing speed.

For example, if you don't want it to use more than say 1GB RAM (for web requests, not including overhead for the server/OS/etc) then you could turn performance info on and look for the typical memory usage of quiz start pages. Say it's 128MB, then set your server's max connections to 8.

The difference over standard behaviour is, say if your server can handle 20 quiz start requests at once and they all take 10 seconds, or it can handle 10 at once and they all take 5 seconds. Limiting the number of requests passed on by the server to 10 doesn't reduce the total amount of work done by the server but it does improve the average performance: 10 people have to wait 5 seconds, then the other 10 have to wait 10 seconds (5 in Apache queuing their request, another 5 in actual processing), instead of everyone having to wait 10 seconds. It also halves memory consumption.

Has anybody tried this kind of approach? I suspect it requires careful tuning and might break things but it seems a lot less hacky. Basically, I think the way people are running Moodle on a small server might be effectively making a promise - 'Hey Apache, I can handle 20 simultaneous requests, bring it on!' - which the server can't really deliver.

--sam

 
Average of ratings: -
Picture of JD Moodle
Re: The quiz function of moodle 2.3.2 seems to put quite a strain on a server
 

By the way, this is just a thought and I don't know how it really would work, but seeing these results put it into my mind: would it be possible to simply limit the number of requests the webserver handles concurrently, as another way to solve this problem?

I don't think PHP has some kind of queueing framework for this.  Maybe Apache does. I think the easiest solution would disable the ATTEMPT QUIZ button for a certain random time.

However, Moodle 2.4 should give us vast performance optimization.  we shall see!

 
Average of ratings: -
Picture of Visvanath Ratnaweera
Re: Improving the performance of quizzes
Group Particularly helpful Moodlers
Yes, there should be methods outside Moodle to achieve this. Things in the networking layer like QoS, traffic shaping (firewalls) and other filters. See for example "mod_bwshare setting for moodle" https://moodle.org/mod/forum/discuss.php?d=214511.

Making Moodle quizzes to perform well on this kind of server farms https://moodle.org/mod/forum/discuss.php?d=214372 and at the same time not to tax a $ 7.99 shared hosting plan can only kill the module.
 
Average of ratings:Useful (1)
Picture of JD Moodle
Re: Improving the performance of quizzes
 


Making Moodle quizzes to perform well on this kind of server farms https://moodle.org/mod/forum/discuss.php?d=214372 and at the same time not to tax a $ 7.99 shared hosting plan can only kill the module.

I know that the Moodle Team is working hard on a new caching engine for 2.4, so we'll see what performance gains we get.

The big problem with Moodle is that it has no queueing architecture.  Why not have AJAX calls that check the queue for each request?  If 300 students all press the ATTEMPT QUIZ button at the same time, why is it important that all of them get a response within 2 seconds?

I could see some students getting a message "Thank you for waiting, you are 230 out of 300... please wait" -- then allow Apache to process them sequentually.

I think Moodle is making educational instutions blow lots of cash on expensive hardware, when it could run fine by simply forcing students to wait to start a few seconds.

 
Average of ratings: -
Picture of sam marshall
Re: The quiz function of moodle 2.3.2 seems to put quite a strain on a server
Group DevelopersGroup Particularly helpful MoodlersGroup Testers

Off the top of my head, I think I was referring to the Apache MaxClients directive. You set something like 'MaxClients 8' and 'ListenBacklog 256': then it will only process 8 requests at once, while allowing 256 to wait in a queue for one of those 8 slots to become available.

This may be out of date or I might have got the names slightly wrong, but it isn't complicated to configure. (Of course it requires access to the Apache settings!)

You ideally want to do it at web server level not at php level, because it wastes memory/processes to have PHP sitting around (vs. a connection in an apache backlog).

Basically I think this could be useful on a very small server with limited RAM and/or CPU, such as a VPS.

--sam

 
Average of ratings: -