Sonar analysis takes long time

2019-05-11 18:18发布

问题:

My sonar analysis takes a long time to complete. Initially it took around 20-30 mins. Later it increased to 1hr+. Now after 5 months it takes whole 5 hours. Can someone suggest the reason and how to rectify the same.

I use sonarqube 4.4 with postgresql 9.3 db. The sonar db takes up almost 40G of space.

If you check my log below you will notice that most of the time is spent on IndexProjectPostJob.

08:53:47.437 INFO  - Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
08:53:48.687 INFO  - Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
12:56:24.924 INFO  - Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
12:56:26.601 INFO  - -> Keep one snapshot per day between 2015-06-10 and 2015-07-07

回答1:

If you have lots of Junit/Integration tests that run each time sonar is analyzing your code it can take a long time before it is finished.

If this is the case , maybe you should move (part) of your tests (for example the once that use the db) to a separate sonar project, which you'll only run once in a while. And run only your small and real unit tests.



回答2:

You probably have a lot of snapshots. Would it be possible to delete some. Which version of SonarQube do you use ?

Regards.