Tips for speeding up analysis time?

I am building a .Net Framework solution in AzuRe DevOps with SonarCloud, I was expecting the build to be slower but not by this much.

The MSBuild step before integrating with SonarCloud took on avg 1.5 mins, after integration it takes over 13 mins , and on top of it it takes another 8 mins (and sometimes more) to run the code analysis, so from less than 2 mins it now takes over 20 minutes to run.

Does anyone have any configuration tips for reducing the time it takes to run with SonarCloud?
My build agents are Azure VMs, what would improve performance more, adding more memory or CPU?

Hi @alexvaccaro,
I’m not sure I fully understand this sentence

The MSBuild step before integrating with SonarCloud took on avg 1.5 mins , after integration it takes over 13 mins

Do you mean that without Sonarcloud analysis, it takes 1.5min and with the Sonarcloud analysis, it takes 13 min? Are you talking about the “Prepare Analysis Configuration” build task?

Regards,
Christophe

This sounds very similar to a problem a team I’m supporting are experiencing. They have a solution with 4 c# projects. Similar setup to the above except these are .NetCore projects rather than .NetFramework. Without SonarCloud steps, the build process takes 16sec. With SonarCloud steps, the build process takes nearly 16 minutes. Looking through the build logs, most of the build time seems to be with one other projects in the solution only. Is there a way to understand why this may be the case?

Regards
Anthony

Yes, with adding “Prepare Analysis Configuration” to my build the MSBuild task takes just over a minute, after adding the “Prepare Analysis Configuration” the same MSBuild task takes 13 mins on avg

Hi @alexvaccaro

Is that possible for you to share the Prepare analysis task log in debug mode ?

Can you check on your side that the bandwitch allocated to your Azure VM is sufficient ? By the way, in which location is it ? We don’t have any CDN, may it be a slowness on that side.

Thanks in advance.

We are having a similar issue as well, however we are using Microsoft hosted-agents, so not able to affect the hardware profile or location. The point you made about CDN though, where is the Sonarcloud datacenter located? This maybe a factor for us.

Hi @Christophe_Havard @mickaelcaro - We are having the same problem with our project where adding SonarCloudPrepare step significantly increases the website build time from about 3 m to about 30 m. we are using Microsoft hosted-agents and Branch and Pull Request analysis.

When I checked website build step log saw these two errors this could be the issue ?
SCM provider autodetection failed. Please use “sonar.scm.provider” to define SCM of your project, or disable the SCM Sensor in the project settings.

2020-10-10T11:41:10.0710604Z INFO: ‘sonar.coverage.jacoco.xmlReportPaths’ is not defined. Using default locations: target/site/jacoco/jacoco.xml,
target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml

Hello there,

Could each of you gives us a background task id where the build takes a long amount of time ? So that we can try to see the hotspots on our internal logs.

Thanks in advance.

@mickaelcaro could you please let us know the steps to get it, So that we can share

@mickaelcaro there ?

You can go to the Administration -> Background tasks menu of your project on SonarCloud, you should be able to find one of those in the “ID” column.

@mickaelcaro These are two generated with same build no.

AXUjLRbals90NCNiJT4w
AXUjHX2DW0v-Wi2Pp2H8

Website build step took 32m 10s

Let me know if you need anything else

1 Like

@mickaelcaro Are you analyzing the issue ? I don’t see any response since I sent Background Task ID

Hi Summit,

I looked into your background task performance data and shared the data with @mickaelcaro and @Christophe_Havard. We are investigating.

By the way, the community support is not a paid support, we have zero support role in the team and no SLA. We do it with all other engineering activities we have to do on a daily basis. Would you please consider this to set your expectations? Thanks.

Best.

Thanks for the update @Olivier_Schmitt, Keep us posted then

Looking at one of your background tasks I did not spot an anomaly from what we can see on other projects belonging to other customers.

Your project has almost 300K Lines Of Code (LOC) and it’s made of:

  • 150KLOC of C# : ± 2 minutes, this perf is aligned with what we see for other projects
  • 96 KLOC of JS : ± 3 minutes, this perf is aligned with what we see for other projects
  • 45 KLOC of Web : < 30 sec to analyze
  • 5 KLOC of XML: < 30 sec to analyze

I would say that the sensors which analyze your code can take up to ± 7 minutes, if this analysis is a good sample.

But there are other steps and did not see something significant too: all steps seem pretty fast.

So it might be what is before/after the scanner runs and we don’t have data here.

Could you provide a screenshot of your build pipeline steps with the names and durations?

Thanks.

@Olivier_Schmitt Sure

@Olivier_Schmitt @mickaelcaro @Christophe_Havard Here’s the screen shot of build step with their respective time

Overall Build take around 1h 21m while website build its own took around 42m - half of the entire build but if remove SonarcloudPrepare steps it only take 2-3 min

Screenshot w/ SonarcloudPrepare step enabled

BuildStep2

Screenshot w/o SonarcloudPrepare step enabled
BuildStep3

Let me know if anything else is required

Hi @Schumi and thanks !

How many warnings do you have in your build step ? Is there any kind of verbose mode enabled ? Just to see if this is a bit too chatty.

@mickaelcaro Build step has 11 warnings and I’m not sure about your 2nd question - How can I check if verbose mode enabled Please share the steps