Code Analysis taking too long on Self Hosted Agent compared to Microsoft Hosted Agent

  • ALM used: Azure DevOps
  • CI system: used Azure DevOps
  • Scanner command used when applicable:
    sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/.trx
    sonar.cs.vscoveragexml.reportsPaths=$(Agent.TempDirectory)/**/
    .coveragexml
  • Languages of the repository: C#

The issue currently is that when we run SonarCloud analyis on a microsoft hosted agent, the Code analysis only takes about 3 mins to complete.

When we run it on our self hosted agent, the code analysis takes 20 mins which is a lot longer than we’d like.

looking at the raw logs, I can see that the microsft hosted agent runs show caching is being done and not for the self hosted agent, but again I am not too sure currently if that is the reason for the difference.

Microsoft hosted agent Run code analysis task:

Self hosted agent Run code analysis task:

The Self hosted agent has been upgraded to 8CPU 32 RAM but issue still persisted.

Any help would be appreciated as I have been stuck on this for a while, and being able to cut that time down would improve our build times massively.

Hi @omer.alialshiekeh,

Try to get verbose log on both agent and compare them. Depending on the steps which takes more time, you may understand the cause (network/proxy, disk access, memory…)

Hi @omer.alialshiekeh,

Welcome to the community!

This guide may also help.

 
Ann