Managing Memory in Data API Calls

This article is provided to help explain how memory operates in your Learnosity sessions, and why some sessions may appear to be smaller than others, but could actually cause a memory related error.

When calling the Data API, there are numerous types of API calls that can lead to "out of memory" issues. When you encounter an out of memory issue, you’ll receive an error stating ‘Response size too large’ (HTTP error code 400, and Learnosity error code 20027).

While there is guidance on the limit of sessions the Data API can handle, this is not a hard and fast rule. For example, our guidance on the maximum number of students in some of our reports is 100 (except the Large Group Report which was developed to handle up to 200k users). However, the number of students a report can handle will also be determined by session size. As you can see on our reference site, sessions include other elements (endpoints) such as responses, scores, metadata and more.

Elements that can increase session size

The points below apply directly to the Response Analysis Report but can also impact Data API calls. The following list provides examples of things that can increase the size of a session:

  • Excessive number of Items, and large Item size (Items, Questions and Features all contribute to the memory being used. It's best to try and keep the number of Items under 100 and the size of any Item, Question or Feature small.  
  • On the differentiation between Items, Questions and Features, it's best not to fill Questions with too much data (it's better to have large sections of text and supplemental information in a Feature or directly in an Item).
  • Base64 encoding schemes can lead to out of memory issues quickly given its poor data density (we recommend uploading images and large files to Learnosity so that they can be delivered via our Content Delivery Network (CDN)).

Sessions can also contain data from you, the customer, and this can also influence the total session size. If there are additional objects contained in the request that you send, this is likely to add to the overall session size. 

Therefore, one request from you can be smaller in terms of the number of sessions, but larger in total size (due to the differing constituent components inside those sessions). So back to the Reporting example, a request containing 65 students may cause an out of memory issue, while another request containing 100 students may work without a problem. 

In the past, we've seen clients that have added large amounts of session metadata that has led to this 20027 error. There isn't a limit to the session metadata, but it's worth checking that it's not hundreds of lines. We've also seen base64 encoded images inline in the content leading to this error. To address this, uploading images to Learnosity will allow us to deliver them through our CDN and reduce the size of your sessions.

For any queries or more information on this topic, please contact our Customer Support team.

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.