# SonarQube Background Tasks are taking long

**URL:** <https://community.sonarsource.com/t/sonarqube-background-tasks-are-taking-long/107192>\
**Category:** SonarQube Server / Community Build\
**Tags:** background\_task\
**Created:** [January 11, 2024, 11:58am UTC](https://community.sonarsource.com/t/sonarqube-background-tasks-are-taking-long/107192 "2024-01-11T11:58:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![taybeh](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/taybeh/32/74180_2.png) [@taybeh](https://community.sonarsource.com/u/taybeh)\
**Post date:** [January 11, 2024, 11:58am UTC](https://community.sonarsource.com/t/sonarqube-background-tasks-are-taking-long/107192/1 "2024-01-11T11:58:19Z")

</div>

We are currently facing a critical issue with our **SonarQube Enterprise Edition v10.3.0.82913**. The **background analysis tasks** for projects are randomly taking an excessively **long time** , often exceeding 72 hours. As a result, we find ourselves having to restart the server to force cancel these tasks. Our Azure DevOps pipelines are impacted, resulting in timeouts and failures.

We have attempted to address this issue by increasing the number of workers to the maximum allowed (10), but unfortunately, we are still encountering the same prolonged processing times. Our team has diligently reviewed both the CE and web logs, but we were unable to identify any exceptions being thrown.

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [January 16, 2024, 5:11pm UTC](https://community.sonarsource.com/t/sonarqube-background-tasks-are-taking-long/107192/2 "2024-01-16T17:11:25Z")

</div>

Hi,

Welcome to the community!

You describe this as random, but I wonder if there’s any pattern to be noted with

- project
- project size
- time of day

[The docs](https://docs.sonarsource.com/sonarqube/latest/instance-administration/compute-engine-performance/) include some things to consider when tuning for performance:

> Increasing the number of workers will increase the stress on the resources consumed by the CE. Those resources are:
> 
> - the DB.
> - disk I/O.
> - the network.
> - heap.
> - CPU.
> 
> Of those, only the last two are internal to the CE.
> 
> If slowness comes from any of the external resources (DB, disk I/O, network), then increasing the number of workers could actually slow the processing of individual reports (think of two people trying to go through a door at the same time).

I would probably back down from having 10 workers configured (how many are active simultaneously?), and look at the other factors.

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![taybeh](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/taybeh/32/74180_2.png) [@taybeh](https://community.sonarsource.com/u/taybeh)\
**Post date:** [January 18, 2024, 6:31am UTC](https://community.sonarsource.com/t/sonarqube-background-tasks-are-taking-long/107192/3 "2024-01-18T06:31:20Z")

</div>

Hello,

Thank you for your response.

We’ve scanned the logs for failures but found no discernible patterns (in web and ce logs). Can you specify where we should focus within the logs? While contemplating switching to trace logging, we’re concerned about potential performance impact and excessive logs. However, if errors exist, shouldn’t they be captured even in the info logging mode?

Our project experiences intermittent success and failure. We’ve diligently followed the referenced documentation regarding the CEs, all followed except for the disk as it is not SSD. With a daily analysis load of around 1,000, reducing workers may prolong background tasks.

The core issue surfaces when analysis tasks get stuck in progress, impacting SonarQube’s quality gate status without reflecting in Microsoft Azure DevOps Server 2022.

Abdullah

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [January 18, 2024, 1:12pm UTC](https://community.sonarsource.com/t/sonarqube-background-tasks-are-taking-long/107192/4 "2024-01-18T13:12:52Z")

</div>

Hi,

First, did you consider the factors I listed in my previous reply at all?

I’m not asking for patterns in logs, but patterns in occurrences.

Regarding logs, I would not go to `TRACE`, but IIRC, `DEBUG` will get you SQL statements in the logs. That could allow you to pinpoint precisely where in the process things slow down. Which brings me to the database. Have you check its performance? Have you checked the network between SonarQube and the DB?

And again, I would back off from having 10 workers configured unless you have a _very big_ server under SonarQube.

&nbsp;  
Ann
