Sonar Scanner taking too long for analyzing

Hello,

My code base having multiple modules with around 700+K - when I try to run the Sonar Scanner analysis on the entire code base it was taking around 50 mins and however the server-side analysis completes in under 5 mins.

Below are my configuration details:
Sonar Qube v8.2 Developer Edition
Sonar Scanner Version 3.0.3.778 (Jenkins installation)
Jenkins ver. 2.204.1
Version Control - GIT

It doesn’t make much advantage if I need to spend 50mins for every build which runs for every commit form the developer and it becomes more critical when we run against a PR.

So, I tried to breakup the Sonar scanner analysis per-module basis, even after this one module(biggest of all) is taking around 20mins which doesn’t sound a good work-around. Also, it take around 6 - 7 seconds for a single line analysis, below are the few logs:

INFO: 2183 files indexed

INFO: 0 files ignored because of inclusion/exclusion patterns

INFO: 0 files ignored because of scm ignore settings

INFO: Quality profile for css: Sonar way

INFO: Quality profile for java: DW Java

INFO: Quality profile for js: DW JS Profile

INFO: Quality profile for jsp: FindBugs Security JSP

INFO: Quality profile for ruby: Sonar way

INFO: Quality profile for xml: DW XML Profile

INFO: ------------- Run sensors on module CoreCommerce

INFO: Load metrics repository

INFO: Load metrics repository (done) | time=22ms

INFO: Sensor JavaSquidSensor [java]

INFO: Configured Java source version (sonar.java.source): none

INFO: JavaClasspath initialization

WARN: Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property.

INFO: JavaClasspath initialization (done) | time=15ms

INFO: JavaTestClasspath initialization

INFO: JavaTestClasspath initialization (done) | time=4ms

INFO: Java Main Files AST scan

INFO: 1703 source files to be analyzed

And, it would be best if we have a incremental analysis which will save lot of time and sadly it was discontinued from Version 5.2.

Could someone help to improve the timing please.

Thanks in advance

Hi,

This is going to get better in 8.3.

MMF-1870 - SonarJava 6.3: improve performance

 
Ann

1 Like

And I believe version 6.3 of the Java analyzer is available now in the marketplace.

 
:slightly_smiling_face:
Ann

Thank you, will try that

Thanks much…!! the scanner time has drastically reduced by 30 mins.

1 Like


I am scanning an Ionic project, and it takes a complete 18 minutes. I want to reduce the time it takes. How can I do that?

NODE_OPTIONS=“–max-old-space-size=4096” sonar-scanner -Dsonar.host.url=http://18.:9000 l -Dsonar.scm.exclusions.disabled=true -Dsonar.projectVersion=1.0 -Dsonar.exclusions=/*.apk -Dsonar.java.binaries=build/classes/java/main -Dsonar.exclusions="/*.java,/node_modules/,/e2e/"

Hi @Akshay_Roy,

Welcome to the community!

This solved topic is 4 years old. Per the FAQ, you shouldn’t resurrect topics older than 2 months.

Please create a new topic with all your details.

 
Ann