504 error

46 views
Skip to first unread message

Jared Chapman

unread,
Dec 8, 2015, 9:40:53 AM12/8/15
to Canvas LMS Users
I am building a custom LTI that adds gamification to Canvas (delphinium.uvu.edu). I have been running it in my courses this semester and things have been going fine till now at the end of the semester. I have 100 students and over a hundred assignments for each student, so the submissions API is returning a lot of data.

It takes too long to return so the server is returning a 504 error.

First of all, even if it is a few thousand records, why would it take so long? Is the API just slow? It seems like google can process a few million records in a fraction of second, but the submissions API takes up to 45 seconds or more to return a few hundred records.

Anyway, does anyone have any suggestions on the best way to do prevent the 504 error and/or get the data in quicker? 



A few thoughts:

I can't store the content locally in a DB because submission data is very dynamic, for a leaderboard to work, it needs to have current information, same goes for most other game elements like health, progress, etc.
I am considering pagination, but that just adds more time to the request and I'm not sure it would solve the problem
Do you think I am getting throttled for asking for too much data at once? That would be a pain if that were true, I need the LMS to provide my students with relevant data, I would hate to find out that the LMS is stingy with giving the student their data. My understanding though that the error for throttling is 403, not 504.

Thanks in advance for your help!

J

Jared Chapman

unread,
Dec 8, 2015, 10:42:32 AM12/8/15
to Canvas LMS Users
I did some testing with pagination and that didn't help. For example, consider this api call


It still times out, so, if I read that right, it has nothing to do with downloading the data, it is that it is processing too slow with the canvas server.

However, that call works fine in a course that has no student submissions, which seems to rule out throttling.

To me it seems like a bug in the API that makes it run crazy slow when there are a lot of records, regardless of how many are asked for.

It seems to work better in the wee hours of the morning when no one else is accessing the server.

Jared Chapman

unread,
Dec 8, 2015, 11:00:37 AM12/8/15
to Canvas LMS Users
After a little more experimentation, if I ask for one student it is fairly quick, but I need all the students for a leaderboard.

Jared Chapman

unread,
Dec 8, 2015, 11:35:35 AM12/8/15
to Canvas LMS Users
In another experiment, I added all of the student IDs to the call instead of using the ALL parameter and it timed out as well.

It seems like the submissions API is just not very efficient, or am I reading this wrong? Is there a way to increase the time out period or speed up the submissions API?

Jared Chapman

unread,
Dec 8, 2015, 2:40:43 PM12/8/15
to Canvas LMS Users
Until the submissions API gets more efficient, we have decided on a work around where we will asynchronously pull submissions in 10 or 20 student batches, all at the same time. Hopefully we can get them all to come in in under 20 seconds.

This is probably more work for the server, but we can't afford to wait 50 seconds or longer or worse time out.

If there is a better solution, I'd love to hear it, thanks!
Reply all
Reply to author
Forward
0 new messages