Optimize CD/CD agent / runner to improve sonar analysis performance

Hello Sonar Community,

We’re using SonarQube 8.4 to analyze our Java & Angular JS projects. We’re currently happy with the results that we’re achieving, but we’re not really happy about the performance of the analysis, specially in our biggest project. This project has 516k lines of code (12258 files) and when we run the analysis using the ‘Sonar way’ quality profile for Java code it takes around 55’.

We run our analysis with the following command:

mvn clean package sonar:sonar

This command also runs the UTs (the execution of the UTs takes 7’ if we execute it alone)

Our Jenkins agents are virtual machines with the following flavor:

  • 50 GB HDD (SSD)
  • CPU (8 cores - Intel® Xeon® Gold 5220 CPU @ 2.20GHz)
  • 16 GB RAM

What would be your recommendations in order to achieve a faster build?

  • Adding more RAM to the VM / allocating more RAM to the analysis?
  • Move our analysis to a VM with a better CPUs (frequency? cores?)
  • Any specific configuration on maven or on the sonar analysis?

Regards,

Javier G.

Hi Javier,

Let’s look into this issue in deeper detail:

  1. Please share the entire logs with profiling and debug mode activated. This will help us understand where does the scanner spend time: mvn clean package sonar:sonar -Dsonar.showProfiling=true -X

  2. According to you, the part that is slow is the scan of the Java part, correct? How many Java lines are scanned? And how many JS lines?

Thanks,
Daniel

Hello Daniel,

Thanks for your quick response. I enabled the profiling & debug mode, and I have +500 MB in logs - so, I don’t think I can attach that. Is there something in particular that I should check in those logs?

The part that’s slow is Java part - we have ~500K of Java code and normally all of them are scanned (is there a way to check if that’s exact amount ?) - at least on sonar ui it appears as ~500k so, I guess that’s correct

Regards,

Javier G.