Installation

WebWork on AWS

WebWork on AWS

by Eric Gilson -
Number of replies: 10
I recently installed WebWork on an AWS t2.micro instance. I used the Ubuntu 14.04 image and then followed the WebWork 2.10 installation guide on the Wiki. My course is up an running, but I am having a major issue: the server times out a lot, under relatively light loads. Simply having 10 students log in simultaneously in class taxed the server to the point that it would take minutes to respond to their requests, if it responded at all.

As I am very new to running a server, I am not sure where to begin in trouble shooting this. My guesses are 1) I need to change my Apache server settings, 2) Amazon is throttling the traffic, 3) a t2.micro instance is too small. I really don't know how to figure out which is the issue, or if it is something else.

Any thoughts on where to begin or what to look at would be greatly appreciated.
In reply to Eric Gilson

Re: WebWork on AWS

by Michael Gage -
Hi Eric,
I haven't used these myself but the consensus seems to be that the t2.micro instance is too small, specifically with respect to RAM.  One should have at least 2Gig of RAM and probably 4Gig is better in order to run WeBWorK.  Even then you should severely limit the number of children (clients) that the webserver can create so that you don't create more child applications than can be fit into RAM simultaneously.  (Too many children and there is serious thrashing as the applications are transferred from RAM to hard disk and back. )

Hope that helps.

Take care,

Mike


In reply to Michael Gage

Re: WebWork on AWS

by Eric Gilson -
Mike,

That is what I was afraid of. It is unfortunate that only the t2.micro instance is free for the trial on AWS. I need to chat with my school's IT department about this issue. For now, I have added 4Gb of swap memory. I know it is not as good as actual RAM, but it will cut down on the Out Of Memory lockups. I have also cut down the Apache child processes and reduced the Apache timeout to try and keep the RAM clear. This seems to be working, though I only have ~30 possible users right now. I have not tried another mass log on and was hoping to have other teachers try it out in their classes too this year. So I think I need to upgrade the server.

-Eric
In reply to Eric Gilson

Re: WebWork on AWS

by Arnold Pizer -
Hi,

If your server options don't work out, the MAA offers free hosting for one course for one year. See http://webwork.maa.org/free_trial.html

Arnie
In reply to Arnold Pizer

Re: WebWork on AWS

by Eric Gilson -
Arnie,

Thanks for the info. I actually used the MAA free host last year so was looking for a new server option for this year.

-Eric
In reply to Michael Gage

Re: WebWork on AWS

by Eric Gilson -
My school is looking at other options and are trying to figure out the minimum specifications for this installation. I see that 4Gb is recommended, but is that for a university level system? At most we are looking at ~350 users for the system this year and that is probably a big overestimate. My practical guess would be more like 100. Would 2Gb be a reasonable amount for smooth operations with that many users or does a WebWork server really need more for that many users?

Thanks!
In reply to Eric Gilson

Re: WebWork on AWS

by Michael Gage -
The critical number is the number of simultaneous users at peak periods. So if you are using for a class of 30 students in the classroom that could be heavy load, while if you are using it for 300 students for homework (and the homework is due at 6am in the  morning) then chances are the peak load would be small. 

Unfortunately handling load on any webserver still seems to have a lot of art in it and only some science.  One needs to experiment.
In reply to Eric Gilson

Re: WebWork on AWS

by Danny Glin -
I consider 2GB the bare minimum to even get WeBWorK up and running.  The rule of thumb I've been using is that the first GB of RAM gets used up by other stuff (the OS, the database, etc.).  Any RAM beyond that can generally be used by the WeBWorK apache processes.

If you severely limit the number of apache child processes (I would say start at 5 with 2GB of RAM), then you can likely keep the system from running out of RAM, but there is a good chance you will see slow performance, since processes need to be destroyed and created often.  Also, at times of high load (lots of simultaneous requests), users will have to wait for the next available apache process.
In reply to Danny Glin

Re: WebWork on AWS

by Eric Gilson -
As an update, I upgraded to the t2.small server size. This gives 2Gb of RAM. In addition, I have 4 Gb of Swap Memory setup. For the Apache server, I used MaxRequestWorkers of 20 and MaxConnectionsPerChild of 15. This was tested with 12 users logged in at once. There were no memory issues and the site ran at a reasonable speed.

Thanks for the help in pinpointing the issue!

In reply to Eric Gilson

Re: WebWork on AWS

by Danny Glin -
One thing to watch out for: pages that load a lot of questions at once (the Library Browser and Gateway Quizzes are the two most common offenders) eat up a lot of memory.

If these are only accessed occasionally, you probably won't run into any problems, but if many requests of this type come through in a short period of time (e.g. an entire class starting a gateway quiz within a short time frame), then you may see all of your RAM getting used up.

Danny
In reply to Eric Gilson

Re: WebWork on AWS

by Arnold Pizer -
Hi Eric,

How are things working out with your AWS installation?  I'm sure quite a few people would be interested in your experiences, e.g. regarding performance and cost.

Hope the fact that we haven't seen any postings on the forums from you means everything is going smoothly.

Arnie