Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download requests made in bulk failing #1676

Open
malee1975 opened this issue May 3, 2024 · 1 comment
Open

Download requests made in bulk failing #1676

malee1975 opened this issue May 3, 2024 · 1 comment

Comments

@malee1975
Copy link

Not sure if this is a code related issue, or a network issue. or node related issue. It is hard to pinpoint any root cause as the data received is variable and inconsistent. When requesting downloads in bulk from the Graph API using Fetch and node JS there appears to be an intermittent problem.

At first it was assumed that node and fetch were struggling with the number of requests being made for example we would run an API request to gather info on 1000 files and for each file request a download using the methods provided by the SDK.

What was initially discovered was that when 2000+ files were requested multiple downloads would fail. For example, only 700 of these files would land on disk. In circumstances where downloads were failing there appear to have been no retry attempts.

The flows were checked for event loop lag and the CPU for excessive usage. Neither were apparent as issues. What was indicated in a error response was that fetch was just failing. It was not receiving a response.

A timer was added to create a space between individual requests, this worked and did mediate well. However, it was also apparent that download requests were failing when smaller amounts of files were requested, for example between 400 and 500. It is conceivable that this should not be a problem for an API to manage.

I am just wondering if other SDK/Graph users have encountered this issue.

@malee1975
Copy link
Author

To reply to myself!

Microsoft support confirmed that the issue was throttling.

If there are too many concurrent requests the server stops responding.

The issue arose because of the use of async in Node and how it generates requests in parallel.

I solution was to use semaphore to limit the number of concurrent requests to 4.

This way during bulk operations the 429 response codes are respected.

To me this should be part of the online documentation.

async-sema

@malee1975 malee1975 reopened this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant