WeBWorK Main Forum

Optimizing server settings for webwork

Optimizing server settings for webwork

by Tony Box -
Number of replies: 4
Hi All,

What are some good ways to improve the performance of the webserver that's running Webwork? Last semester, we were running into serious issues where students would take a quiz, try to submit an answer, and the page would hang. They'd have to refresh the page or hit the browser back button and re-submit the answer multiple times to try and get it to submit. This would occur at seemingly random times throughout the day, but mostly at night or very early in the morning (2am).

I've since updated to the newest version of Webwork in hopes that it would improve the performance. I just had a report from a faculty member who said that Webwork was acting up again.

For the old server, we threw a crap ton of memory and processors on it and still encountered the issue so it's clearly not an underpowered issue. What types of things should I look for on the server that might cause the pages to hang when loading?

I know this is a pretty broad question, but any help is most appreciated.

In reply to Tony Box

Re: Optimizing server settings for webwork

by Lars Jensen -
Hi Tony,

The problem may be that some of your apache processes are allowed to grow too large. You can limit them using the Apache2::SizeLimit module. (This module is already installed with apache2, so you don't want to download it from CPAN!). See discussion here:

If I recall correctly, the only thing we did was to add the line 

PerlCleanupHandler Apache2::SizeLimit

to the end of /etc/apache2/apache2.conf

and our slowdown problem went away. I don't think we did any of the other configuration mentioned in above link.

In reply to Tony Box

Re: Optimizing server settings for webwork

by Danny Glin -
The following is taken from the Installation Manual for Ubuntu on the wiki, but it applies equally to other flavours of linux:

Next seach for the lines

    MaxClients          150
    MaxRequestsPerChild   0

Which occur under <IfModule mpm_prefork_module> and replace them by

# For WeBWorK a rough rule of thumb is 20 MaxClients per 1 GB of memory
    MaxClients           20
    MaxRequestsPerChild  100

where you should set MaxClients depending on the amount of memory your server has using the above rule of thumb.

NOTE: If you are using Apache version 2.4 or higher (available in Ubuntu 3.10 and later) you should use MaxRequestWorkers instead of MaxClients and MaxConnectionsPerChild instead of MaxRequestsPerChild. Furthermore, in Apache 2.4 these directives are stored in the file /etc/apache2/mods-enabled/mpm_prefork.conf.

This is done to account for a memory leak in pg which causes apache processes to eat up more and more RAM.  This info should probably be copied to the general installation instructions.

In reply to Danny Glin

Re: Optimizing server settings for webwork

by Andras Balogh -
These are extremely significant settings.
Without it we had constant memory swapping with performance degradation and error messages on an 8GB server with less than 500 students.
In reply to Tony Box

Re: Optimizing server settings for webwork

by Tony Box -
Thanks so much, Danny and Lars! I've done both of your suggestions. If you don't hear back from me, assume it worked!