arcade-services icon indicating copy to clipboard operation
arcade-services copied to clipboard

Dependency table loads for quite long for some channels

Open premun opened this issue 1 year ago • 5 comments

Example: https://product-construction-prod.wittysky-0c79e3cc.westus2.azurecontainerapps.io/channel/5173/github:dotnet:sdk/build/latest

premun avatar Oct 14 '24 13:10 premun

We seem to be spending a lot of time waiting for a response from the API, I'll check if we can do something about it Image

oleksandr-didyk avatar Nov 05 '24 15:11 oleksandr-didyk

Since Maestro's BarViz is behaving the same and this issue seems to be on the API side, will remove the BarViz prefix

oleksandr-didyk avatar Nov 06 '24 08:11 oleksandr-didyk

Ran local instance of BarViz against production database and confirmed that the extended duration of the call comes from the service waiting for a response from the database for certain builds that have a large graph (like the one in the example).

To speed up the request we would need to optimize the database query we perform, which I am not sure we want to spend time on now

CC: @premun

oleksandr-didyk avatar Nov 11 '24 12:11 oleksandr-didyk

@oleksandr-didyk can you paste an example query so that we have that on hand whenever we decide to address this?

premun avatar Nov 11 '24 12:11 premun

Query ID: 918460

(@id int)WITH traverse AS (
        SELECT
            BuildId,
            DependentBuildId,
            IsProduct,
            TimeToInclusionInMinutes,
            0 as Depth
        from BuildDependencies
        WHERE BuildId = @id
    UNION ALL
        SELECT
            BuildDependencies.BuildId,
            BuildDependencies.DependentBuildId,
            BuildDependencies.IsProduct,
            BuildDependencies.TimeToInclusionInMinutes,
            traverse.Depth + 1
        FROM BuildDependencies
        INNER JOIN traverse
        ON BuildDependencies.BuildId = traverse.DependentBuildId
        WHERE traverse.IsProduct = 1 -- The thing we previously traversed was a product dependency
            AND traverse.Depth < 10 -- Don't load all the way back because of incorrect isProduct columns
)
SELECT DISTINCT BuildId, DependentBuildId, IsProduct, TimeToInclusionInMinutes
FROM traverse

Example times

  • Repo: dotnet/sdk
  • Channel: .NET 10.0.1xx SDK
  • BAR Build ID: 245591
  • Query time: 9.2 seconds

oleksandr-didyk avatar Nov 11 '24 13:11 oleksandr-didyk

This endpoint returns 1.3MB with repos that don't have anything to do with MAUI: https://maestro.dot.net/api/builds/262891/graph?api-version=2020-02-20

This freezes the browser effectively

premun avatar Apr 03 '25 16:04 premun