microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

post request on search/query can be super slow

Open
#1,878 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Question: SDK
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

Hi !
I'm having some trouble using the endpoint search/query and I'm looking for some tips and advice to optimize it.

1st problem:
Although 2 graph queries are launched in parallel and waited for by a Task.WhenAll the queries are executed one after the other as if they were put in a queue.

2nd problem:
Requests on the endpoint search/query can be super slow (3s or more) but this is not constant. The same request can take 3s or 400ms

below is an example of the object sent to the endpoint search.
Thanks for your help.

{ "AdditionalData": {}, "BackingStore": { "ReturnOnlyChangedValues": false, "InitializationCompleted": true }, "Requests": [ { "AdditionalData": { "trimDuplicates": true }, "AggregationFilters": null, "Aggregations": null, "BackingStore": { "ReturnOnlyChangedValues": false, "InitializationCompleted": true }, "ContentSources": null, "EnableTopResults": null, "EntityTypes": [ 2 ], "Fields": [ "id", "name", "lastModifiedDateTime", "lastModifiedBy", "webUrl", "createdBy", "parentReference", "remoteItem" ], "From": 0, "OdataType": null, "Query": { "AdditionalData": {}, "BackingStore": { "ReturnOnlyChangedValues": false, "InitializationCompleted": true }, "OdataType": null, "QueryString": "createdby:\"Nestor Wilke\" OR createdby:\"Allan Deyoung\" OR createdby:\"Christie Cline\" OR createdby:\"MOD Administrator\" OR createdby:\"Adele Vance\" OR createdby:\"Diego Siciliani\" OR createdby:\"Brian Johnson (TAILSPIN)\" OR createdby:\"Robert Smitho\" OR createdby:\"Quentin PLA\" AND filetype:(docx OR doc OR xlsx OR xls OR xlsm OR pptx OR ppt OR form OR pdf OR jpg OR png OR heic OR heif OR jpeg OR gif OR tiff OR raw OR svg OR bmp OR mp4 OR avi OR mov OR webm OR mkv OR flv OR wmv OR mpeg OR m4v OR 3gp OR zip OR rar OR tar OR 7z OR gzip OR cab OR one OR onetoc2) AND lastmodifiedtime>2022-01-01 AND lastmodifiedtime<2023-05-05 AND (createdBy<>\"System Account\" AND createdBy<>\"SharePoint App\")", "QueryTemplate": null }, "QueryAlterationOptions": null, "Region": null, "ResultTemplateOptions": null, "SharePointOneDriveOptions": null, "Size": 10, "SortProperties": [ { "AdditionalData": {}, "BackingStore": { "ReturnOnlyChangedValues": false, "InitializationCompleted": true }, "IsDescending": true, "Name": "LastModifiedDateTime", "OdataType": null } ] } ] }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied search/query request and examine the two graph queries mentioned as running through Task.WhenAll. Measure whether they execute sequentially and when the same request takes 3 seconds versus 400 ms; done means identifying the cause or narrowing it down with reproducible evidence.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.