Asynchronous Requests

The Center for Research Computing has implemented asynchronous requests in its integration of OSF with PresQT. They used the python library aiohttp (https://github.com/aio-libs/aiohttp) to accomplish this.

Example - OSF Resource Collection

When navigating the OSF API for endpoints such as Resource Collection they found that a massive amount of GET requests to OSF would occur. For instance, getting the resources for a fork of the PresQT project (https://osf.io/d3jx7/) took roughly 1 minute and after implementing asynchronous requests it now takes roughly 25 seconds.

Asynchronous requests allows us to group similar API requests together to be made at the same time rather than one at a time. Because of the nature of APIs and needing to hit an endpoint to see where to go further, not all requests could be grouped together so we devised a strategy to group as many as we could. The following image is our solution. Every color is a grouping of asynchronous requests:

Last updated