Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to speed up sonarqube analysis job?

I have one java based application which is having huge line of source code(~1m).Now I am using jenkins with sonar-runner-2.4 to run analysis with code coverage and test cases count.I have upgraded sonarqube server from 5.4 to 6.3.1.Before upgrade this job took 9hrs to complete the whole analysis (still it is very much long time but fine) but after upgrade to sonarqube-6.3.1 same job taking 13hrs to complete the same analysis.

How do I improve analysis time at least my earlier time 9hr ?

EDIT

Here is my JAVA_OPTS for sonarqube-6.3.1 instance

sonar.web.javaOpts=-Xmx6G -Xms2G -XX:MaxPermSize=1G -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true

Available Hardware :

$lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 26 Stepping: 5 CPU MHz: 1596.000 BogoMIPS: 3999.44 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 4096K NUMA node0 CPU(s): 0-3 NUMA node1 CPU(s): 4-7

Available Memory : $free -m total used free shared buff/cache available Mem: 128714 58945 66232 430 3535 68298 Swap: 32767 957 31810

sonar-project.properties for the long running job:

sonar-project.properties

like image 708
chintan thakar Avatar asked May 15 '17 05:05

chintan thakar


People also ask

How long is SonarQube analysis?

Project analysis by the SonarQube (Version 6.72) server always takes approximately 40 minutes.

What is SonarScanner?

The SonarScanner is the scanner to use when there is no specific scanner for your build system.


1 Answers

As you haven't really given many details, I can't really give many details in the answer, but the simple answer is that you have to make the scan do less work.

Look at your codebase. Is your scan processing generated classes? Is it scanning test classes? Is it scanning classes that have little real business logic? If you answer "yes" to any of those, consider excluding those classes.

Look at the SonarQube plugins you're using. Are you running every possible plugin you can run? Are there some heuristics you don't need to run, or perhaps you could run less frequently?

like image 67
David M. Karr Avatar answered Oct 17 '22 05:10

David M. Karr