cancel
Showing results for 
Search instead for 
Did you mean: 
kamal3587
Community Member

Is there any limits on the number concurrent calls to canvas REST API?

Jump to solution

We are using Canvas LMS (Open Source) deployed in one of our server. For getting the Assignment Submissions & Grading, we are accessing Canvas REST APIs. There is a scenario to call Canvas REST APIs concurrently for several users. Is there any limit on number of concurrent calls I can make to Canvas REST API? If so, what?

0 Kudos
1 Solution

Accepted Solutions
James
Navigator

 @kamal3587 ,

Yes, but it's not as simple as a fixed number. The process is explained in API Rate Limiting.

Another place to look is the Throttling page in the REST API documentation. The last sentence there is

For applications that go through the OAuth flow and obtain an access token for each user, each access token has its own quota, and the developer need not be concerned with requests from one user causing another user to be throttled.

That means that if you are making the API calls as the user themselves, because they authenticated using oAuth and you have their token, then you don't need to worry about one user's calls taking away from another user's, at least not directly.

Indirectly, the more calls that are made concurrently, the higher the load on the server, the more time it takes to process, which means that each call has a higher cost and so it reduces the number of calls that can be made. This would be more pronounced if you're running your own server and are not able to scale like Instructure can on the cloud. That's what I meant by it's not as simple as a fixed number.

If you're making all of the calls as a single user, then yes, you will need to watch the limits.

I have a script that sometimes makes up to 50 calls concurrently as a single user, but I delay each call by 100 ms or so them so they don't all hit at the same instant. There's a cost added at the very start, so if they all come at once I will hit the limit and get nothing. Most of the time, I try to keep it under 25, but it depends on how complicated the query is. Even though I'm allowing up to 25 concurrent calls, it only averages about 10-11 API calls per second because of what I'm pulling, which is a lot of assignment and submission data like you mentioned.

If you're running your own instance of Canvas, you can configure the thresholds, but realize that if you set them too high, it takes away the performance of the regular users, so I wouldn't tweak them.

View solution in original post

1 Reply
James
Navigator

 @kamal3587 ,

Yes, but it's not as simple as a fixed number. The process is explained in API Rate Limiting.

Another place to look is the Throttling page in the REST API documentation. The last sentence there is

For applications that go through the OAuth flow and obtain an access token for each user, each access token has its own quota, and the developer need not be concerned with requests from one user causing another user to be throttled.

That means that if you are making the API calls as the user themselves, because they authenticated using oAuth and you have their token, then you don't need to worry about one user's calls taking away from another user's, at least not directly.

Indirectly, the more calls that are made concurrently, the higher the load on the server, the more time it takes to process, which means that each call has a higher cost and so it reduces the number of calls that can be made. This would be more pronounced if you're running your own server and are not able to scale like Instructure can on the cloud. That's what I meant by it's not as simple as a fixed number.

If you're making all of the calls as a single user, then yes, you will need to watch the limits.

I have a script that sometimes makes up to 50 calls concurrently as a single user, but I delay each call by 100 ms or so them so they don't all hit at the same instant. There's a cost added at the very start, so if they all come at once I will hit the limit and get nothing. Most of the time, I try to keep it under 25, but it depends on how complicated the query is. Even though I'm allowing up to 25 concurrent calls, it only averages about 10-11 API calls per second because of what I'm pulling, which is a lot of assignment and submission data like you mentioned.

If you're running your own instance of Canvas, you can configure the thresholds, but realize that if you set them too high, it takes away the performance of the regular users, so I wouldn't tweak them.

View solution in original post