How can I speed up Sonar analysis?

Hi!
We are using SonarQube Enterprise Edition Version 10.2.1
Deployment: Helm
Plugins: Checkstyle 10.12.3, Groovy 1.8
Our biggest project has over 4M lines of code. It’s analysis on PRs is taking from 1 to 1’30 hour. On master it can be more than 2h. It is extremely annoying for our developers.
We are using incremental scan and caching.
What can we do to make it faster?

Hi,

Welcome to the community and thanks for this report!

The first answer to this is always to improve the underlying system. Can you make sure your build agent has a beefy CPU and plenty of memory? Unfortunately, analysis for most languages in single-threaded, so the number of cores isn’t really significant at this point.

Also, can you provide a debug analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Thx,
Ann

Hi Ann,
Thank you for your response. Due to company policy I cannot share logs.
But I wanted to ask what aws infrastructure do you suggest for project that size.
Also - is it possible Sonar somehow doesn’t see that it is analysing PR, and somehow decides to analyse to scan everything?
Project is written in Java.

Hi,

I’m not familiar with AWS offerings. I guess the best thing is to try the next size up and see if that helps any. And even though you’re not getting the error here, it might help to allocate more memory.

That’s entirely possible. The easiest thing to do is look in the UI to see whether it has been treated as a PR (no ‘Overall’ tab) or a branch (both ‘New Code’ and ‘Overall’ tabs).

 
HTH,
Ann