Forum archive 2000-2006

Andy Wildenberg - caching tth output

Andy Wildenberg - caching tth output

by Arnold Pizer -
Number of replies: 0
inactiveTopiccaching tth output topic started 11/8/2001; 3:26:26 PM
last post 11/10/2001; 5:18:16 PM
userAndy Wildenberg - caching tth output  blueArrow
11/8/2001; 3:26:26 PM (reads: 1159, responses: 3)
I've been having some performance issues on my WebWork system, and one thing that I thought of that could significantly improve performance would be to introduce some sort of caching for the tth problems. It's already being done with the latex2html problems, but that's slightly easier since the output of latex2html is just gif files. But what I was thinking of was just to write a little shim program that would keep track of the last n tth requests (and their responses) so that the system wouldn't have to run a full-blown tth job for each request. Since many (of my) students submit many answers to the same problems, this could cause a big performance speedup, as long as the cost of starting the tth shim was small.

So the questions are 1) has anyone else looked into this, 2) does anyone else think it's a good idea, 3) does anyone want to help.

<| Post or View Comments |>

userArnold K. Pizer - Re: caching tth output  blueArrow
11/8/2001; 8:33:47 PM (reads: 1404, responses: 0)
Hi Andy,

This would be quite a project. One thing is that for latex2html (l2h) we cache the whole html page (e.g. 12345output.html) together with gif or png images, so actually doing this for tth is no harder that for l2h. However, there is a lot of code (in many places) that is needed to maintain the caching system for l2h images and this would all have to be duplicated for tth. We hope to be able to do away with latex2html and caching when major browsers start supporting MathML but people have been waiting for this for a long time.

Typeset mode is faster than tth under high loads if you precreate images. I would suggest you use typeset mode (unless you are using constructions that do not work in typeset mode) and precreate images.

Here are a few other suggestions:

First, if your sever is overloaded, figure out the maximum number of apache child processes that can be run simultaneously in an efficient manner [given the amount of memory you have and maybe the speed of your processor(s)] and configure apache accordingly. If you get beyond this limit, performance degrades rapidly.

Here's what we do at Rochester (1300 students on a dual processor 500 Mhz PIII machine with 512 MB of memory --- we just upped the memory from 256 today but haven't changed the apache conf file and we don't intend to) with a largest class consisting of 350 students.

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 10
MinSpareServers 10
MaxSpareServers 25
StartServers 10
MaxClients 25
MaxRequestsPerChild 30

Second, I'm not certain but maybe it's possible to run tth as a process that doesn't have to be restarted every time. I looked quickly and didn't see any mention of this in TtHgold (the commercial version) but maybe someone has done this or would be willing to.

Third, in the short run, better hardware (e.g. a fast dual processor machine with adequate memory) is probably a cheaper solution than is the time in man hours required to implement caching for tth. This is especially true since in the longer run hopefully mathML will replace both latex2html and tth and in the intermediate run mod_perl should speed up WeBWorK by a factor of 10 or so which should be sufficient even with tth being a tiny bottle neck.

<| Post or View Comments |>

userAndy Wildenberg - Re: caching tth output  blueArrow
11/10/2001; 3:06:33 PM (reads: 1423, responses: 0)
So what is the status of mod_perl? I know that you said before that you couldn't use it because WebWork had a memory leak that you couldn't track down. But somebody here suggested that a way around this is to just set up apache so that the lifespan of the processes is short: you pay a higher expense because you're starting more of the processes up, but with the 10x+ speed improvement, I'm sure it would make up for it. Having a seperate 10M process start up every time a student accesses a problem is just a huge cost.

<| Post or View Comments |>

userArnold K. Pizer - Re: caching tth output  blueArrow
11/10/2001; 5:18:16 PM (reads: 1409, responses: 0)
The memory leak was solved last February (thanks to Bill Wheeler) and is included in version 1.7. A patch for for the version 1.6 script in given in$315#317

Bill Wheeler at Indiana is running an expirmental version of weBWorK using mod_perl. We hope to incorporate mod_perl into the regular distribution this spring or summer.

<| Post or View Comments |>