SonarQube server CPU utilization is going above 95%

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): sonarqube enterprise 8.3, azure devops sonarqube extensions.
  • what are you trying to achieve : reduce the CPU utilization.
  • what have you tried so far to achieve this: debugging the logs.

Hi Team, we have 2vCPU, 8 GB RAM, azure B2ms VM.
We have our sonarqube + database set up on same system.
CPU spikes up to 95% during analysis.

Can you suggest how do I resolve the issue? should I try increasing the VM size?
image

Thanks,
Abhishek

Hi,

It’s expected that the CPU use is high while processing an analysis. It does all the computation using one thread and then there is additional overhead in Java with garbage collection and JIT compilers that run in separate threads.
If this is your desktop and it’s slowing things down you could try assigning a lower priority to the process.

Thanks for the quick response @dmeneses,
It isn’t my desktop, its VM and we have only Sonarqube and SQL installed on that and we don’t want the CPU hike rates to go above 60-70%.
Do you suggest adding more core/ram would help me resolve this issue?
or is there a another way around to fix this?

Thanks,
Abhishek

I don’t understand why you’d want the CPU to not go over 60-70%.
If it’s not bound by I/O, the single threaded task of the compute engine will be running at 100% in one core. This is expected and advantageous to process the analysis as fast as possible. Adding more cores will probably bring down the overall CPU use because as I mentioned each report is processed in a single thread (not counting for Java’s overhead)
If you want to artificially throttle the CPU for the process, you can change the priority in the OS or probably with other 3rd party tools but I wouldn’t recommend doing it.

Thanks @dmeneses,
But I am afraid this may burst into the CPU and may result in slowness and abandoning/disown the analysis.