MarkUs Blog

MarkUs Developers Blog About Their Project

Grade Distribution Caching

with one comment

This is a summary and continuation of the discussion from this review. I (Hora) created a function which returns the grade distribution as a percentage for a given assignment, a function which even with eager loading can make a lot of database queries. Since the graphs will tentatively be displayed in the dashboard, often the first page students will see, the question is whether we should cache grade distribution data and how.

Severin had suggested for the creation of a new model (for example AssignmentStats) which can have a column for each type of graph required. In the case of the grade distribution, we could have a column called ‘grade_distribution’ which stores a CSV list of the grade distribution data for the assignment. He further suggested that the graphs initially load as empty container boxes with spinners to indicate loading, and use XHRs to get the required data to generate the graph. Each graph could also have a Refresh link that will re-calculate (and re-cache) the distribution data if the instructor wishes to see the most up-to-date information.

Karen had suggested that we cache the actual generated graph, but Bluff (the graphing API we selected) uses HTML canvas tags to display the graphs and it doesn’t look like there’s a way to save the graphs.

I think Severin’s suggestion is great, and I think it would make sense to update the cached data every time a mark is denoted as complete. I also like the ideas of having a Refresh link that an instructor can use to update the data and using XHRs to get the data. My suggested plan of attack is for Kurtis and I to write the code for generating some of the graphs to see exactly how that would fit into the existing code, then to add caching and make appropriate modifications where necessary to take advantage of it. As long as we don’t release a stable version of MarkUs before we finish the caching, there probably won’t be any problems with some slow-loading graphs. Does that sound like a good idea? Or should I get to work on caching first, and then on generating graphs? Any other comments or suggestions?

Written by horatiu

November 12th, 2010 at 2:41 am

One Response to 'Grade Distribution Caching'

Subscribe to comments with RSS or TrackBack to 'Grade Distribution Caching'.

  1. Hora: Thanks for the write-up!

    My gut-feeling tells me that we should use cached data right from the start. The simplest solution shouldn’t be very hard to implement.

    In my mind it’s not likely that we will be able to finish everything before the next release. Even by introducing new features gradually, we should be careful and try to not scare users off caused by performance problems of a fancy dashboard. As to when those cached data structures get updated, we can worry about that later.

    Anybody else having thoughts about this?

    Severin

    12 Nov 10 at 1:48 pm

Leave a Reply