WeBWorK Problems

latency when several users are accessing at same time

latency when several users are accessing at same time

by Lou Taris -
Number of replies: 9
Hello, we are running webwork version ww2.13 ubuntu 16.04 Vanilla version installed from the LIVE DVD.

Our math faculty have reported that when several users (30 or so) are on at the same time the software is very slow. We are running this as a virtual server and have 2 CPUs and 8GB of RAM and nothing in VMware indicates that the server is underpowered.

Any idea on this? we were previously using WW2.7 and never had latency issues reported to us.

Many thanks! -Lou
In reply to Lou Taris

Re: latency when several users are accessing at same time

by Danny Glin -
First thing to check is your apache settings. (see http://webwork.maa.org/wiki/Installation_Manual_for_2.13_on_Ubuntu_16.04#Configuring_Apache) I'm not sure if the live dvd already has these tweaked but in /etc/apache2/mods-available/mpm_prefork.conf, you should set:
MaxConnectionsPerChild 50
MaxRequestWorkers 30

These are only starting points. MaxConnectionsPerChild controls how many requests an apache process serves before it is killed off, and MaxRequestWorkers controls the maximum number of simultaneous apache processes that will answer requests. Generally 50 is a good value for the former. The latter will depend a bit on usage.

If you still have your old server running, you can also compare the values on it.

Another consideration is whether you are assigning gateway quizzes or just homework assignments. Quizzes are a lot harder on apache because they load all of the questions at once, whereas assignments will only load one question per page.
In reply to Danny Glin

Re: latency when several users are accessing at same time

by Michael Gage -
WeBWorK is pretty RAM intensive and each active "RequestWorker" can take up to 800meg of RAM. If there are too many active workers swapping occurs even if some of the workers are idle. It's actually much faster if there are fewer workers -- if too many requests come in at once the response might be delayed a second or so but that is less disruptive then if the server is constantly swapping memory. A value as low as 10 workers or even 5 might work faster for homework. (The situation for gateway quizzes when everyone submits at the same time is different -- in that case get more RAM :-) )

--Mike
In reply to Michael Gage

Re: latency when several users are accessing at same time

by Ever Barbero -
Webwork 2.12 live DVD installs it like this on Ubuntu 16.4:
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
My old server, 2x4 Xeon, 8GB memory, crashed with 80 students taking a gateway quiz.
I installed Webwork 2.15 live DVD on a newer server, 2x4 Xeon, 32GB memory, Ubuntu 18, by default:
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
It crashed with 56 students taking the same gateway quiz.
Questions:
1- What do you recommend I change parameters to?
2- If I have a set of 40 students taking the test say from 9 to 10 am, next set taking quiz from 10 to 11 am, should I tell the first set to logoff? of just leave the server alone to log them off at idle time?
3- How long is the idle time during a gateway quiz before the system logs you off?
In reply to Ever Barbero

Re: latency when several users are accessing at same time

by Danny Glin -
The most important thing is to set MaxConnectionsPerChild to something greater than 0 (i.e. not unlimited). I use 100, but 50 is also a good choice if you're running a lot of gateway quizzes.
With 32GB of RAM you can probably leave MaxRequestWorkers at 150, but if you continue to run into trouble that would be the value to lower.

In terms of students logging off, that should make no difference to WW performance. The server is only working when a page is loaded, so a student having an active session shouldn't have any effect.

The idle time before a student is logged out is controlled by the variable $sessionKeyTimeout, which defaults to 30 minutes. You can increase that by overriding this variable in localOverrides.conf. Just note that it is measured in seconds, so to set the timeout to 60 minutes you would use
$sessionKeyTimeout = 60*60;

It's worth noting that the timeout resets every time a page is loaded, so if a student clicks "preview answers" it will refresh their session. It's also worth encouraging the students to preview often when working on a gateway quiz because this saves their answers to the database, which means they can be restored if the student has computer problems, and also can be accessed if a student doesn't submit in time.
In reply to Danny Glin

Re: latency when several users are accessing at same time

by Ever Barbero -
Thank you Danny, I will tweak those parameters following your advice. Also 30 min idle time is plenty. Thanks.
A follow up question on a gateway quiz... If a student fails to click GradeTest and his time runs out, isn't the work graded anyway, automatically? no? why?
In reply to Ever Barbero

Re: latency when several users are accessing at same time

by Danny Glin -
If time runs out then the work is not automatically graded. The reason has to do with the design of the quiz module in WeBWorK. Nothing is sent to the server until a student clicks one of the buttons (Grade, preview), so there is no reliable way to trigger a submission on the student's browser when the time runs out.
In reply to Danny Glin

Re: latency when several users are accessing at same time

by Ever Barbero -

OK, makes sense, I'll tell them. Can they click GRADE multiple times as they make progress? 

In reply to Ever Barbero

Re: latency when several users are accessing at same time

by Danny Glin -
Each time they click Grade it uses an attempt, so if you have given them unlimited attempts then that is an option. Otherwise you can encourage them to click Preview, as that saves their answers to the database. It doesn't solve the problem of the exam not being automatically submitted if they run out of time, but it does give you something to go back to if they don't submit.
In reply to Danny Glin

Re: latency when several users are accessing at same time

by Ever Barbero -

Thank you so much for the information. I can remind my students, but at the end of the day, there will be a good number that became engrossed doing the quizz and forget to click GRADE. I think having the system automatically GRADE when the clock reaches ZERO is an improvement/mod worth considering.