> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/performance-issues.md).

# Performance issues

Steps to consider when addressing performance issues in SonarQube Server 2026.5.

In case of performance issues, you may try the following:

* Review the [Server host requirements](https://docs.sonarsource.com/sonarqube-server/server-installation/server-host-requirements.md) for SonarQube Server linked to **Elasticsearch** usage.
* Move the Elasticsearch storage to a storage with high IOPS and low latency. See [Basic installation](https://docs.sonarsource.com/sonarqube-server/server-installation/from-zip-file/basic-installation.md#configure-es-storage-path) for more information.
* Set the [Housekeeping](https://docs.sonarsource.com/sonarqube-server/instance-administration/system-functions/housekeeping.md) with a reduced retention time, to limit the database size.
* Configure the analysis scope to reduce the number of files analyzed, leading to shorter analysis and smaller database footprint. See [Introduction](https://docs.sonarsource.com/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/introduction.md) for more information.
* From the [Enterprise Edition](https://www.sonarsource.com/plans-and-pricing/enterprise/): increase the number of Compute Engine workers and/or configure the Compute Engine to enable parallel processing of pull requests and branch analyses for each project. Make sure the Compute Engine heap is sized accordingly. See [Improving performance](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/maintenance/improving-performance.md).
* For the Data Center Edition on Kubernetes: set up autoscaling. See [Setting up autoscaling](https://docs.sonarsource.com/sonarqube-server/server-installation/data-center-edition/on-kubernetes-or-openshift/setting-up-autoscaling.md) for more details.
* If performance issues occur after a PostgreSQL database upgrade, try reindexing. See [Pre-update steps](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/update/pre-update-steps.md#recommended-database-maintenance-steps) for more details.

## Troubleshooting background tasks processing problems

You detected one of the following conditions:

* Background tasks have been waiting in the queue longer than expected
* Too many tasks are pending in the queue
* A high share of background tasks are failing
* Pipeline failures due to quality gate timeout, resulting from excess background task processing

All four signal the same class of problem: the Compute Engine (CE) is unable to process analyses at its normal rate. This guide walks you through diagnosing and fixing the most common causes.

### Step 1. Understand what is happening

Go to **Administration** > **Projects** > **Background tasks** to see the current queue state:

* How many tasks are pending and how long the oldest one has been waiting
* Whether tasks are failing, and if so, which projects

Enterprise Edition and Data Center Edition: if only a few Compute Engine workers are active (only a few background tasks are in the **In Progress** status) even though many background tasks are pending, see [Refresh background task queue table statistics](#refresh-background-task-queue-table-statistics).

Go to **Administration** > **System** to check the health of the Compute Engine, Web, and Search nodes.

If tasks are failing, click on a failed task to read the error message, this often points directly to the cause.

### Step 2. Check heap size

In `sonar.properties` (or environment variables), verify:

* `sonar.ce.javaOpts` contains an `-Xmx` value of at least 512 MB per worker.
* `sonar.ce.workerCount` × per-worker heap ≤ total RAM available after Web and Search allocations

Correct sizing:

| Web          | 1–2 GB (do not exceed 2 GB)     |
| ------------ | ------------------------------- |
| CE           | 512 MB–2 GB × number of workers |
| Search (DCE) | 2–4 GB                          |

If you recently increased `sonar.ce.workerCount` without adjusting `sonar.ce.javaOpts`, that is almost certainly the cause. Reduce the worker count or increase Compute Engine heap, then restart.

Maven scanner users: If you upgraded the SonarQube Maven plugin to v5.0 or later, `MAVEN_OPTS` no longer controls scanner heap. Use `SONAR_SCANNER_JAVA_OPTS` instead.

### Step 3. Check database performance

Database I/O problems are the second most common cause.

Check `ce.log` for slow steps. If you see any of the following taking more than a few minutes, the database is the bottleneck:

* `Persist issues`
* `Persist live measures`
* `Extract report`

For reference values of what healthy step timings look like, see [Background task processing reference values](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/background-task-performance.md).

[Run database maintenance](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/update/pre-update-steps#recommended-database-maintenance-steps) if it has not been done recently.

Also verify the following infrastructure conditions:

* **Storage latency:** SonarQube requires < 10 ms per write transaction. NFS or EFS mounts and spinning disks do not meet this requirement. It's recommended to provision at least 3,000 IOPS for the database storage.
* **Network latency:** Deploy the SonarQube application node and the database in the same availability zone. A cross-zone deployment can double all step times.

#### Refresh background task queue table statistics

*This section applies to Enterprise Edition and Data Center Edition only.*

Each row in the `ce_queue` table corresponds to one pending or in progress background task. When the table's statistics are outdated, the database query planner can pick a plan that slows down sharply once the table holds hundreds or thousands of rows. Compute Engine workers then take much longer to find their next task, and pending tasks pile up.

Refresh the background task queue table statistics, as shown below, if you see all of the following symptoms in **Administration** > **Projects** > **Background tasks**:

* A large number of pending background tasks.
* Only a fraction of the total number of Compute Engine workers are actively processing tasks (often just one or two). To see how many workers are processing background tasks, set the **Status** filter to **In Progress**.
* Long delays (more than a few hundred milliseconds) between one task finishing and the next starting. If background task execution timing is hard to observe on the **Background tasks** page, check background task execution timestamps in `<sonarqubeHome>/logs/ce.log` (see [Server logs](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/server-logs.md)): `Executed task` messages mark the end of a task, and `Execute task` messages mark the start of a task.

This issue often occurs after a full Elasticsearch reindex, such as one an upgrade triggers, because the reindex creates many background tasks.

To resolve this issue, connect to your instance's database with a user that has the appropriate permissions (for example, the user configured in `sonar.jdbc.username`), and then run the SQL command for your database:

{% tabs %}
{% tab title="PostgreSQL" %}
Replace `<SCHEMA>` with the name of the schema that contains your SonarQube Server data. This is usually `public`.

```sql
ANALYZE <SCHEMA>.ce_queue;
```

{% endtab %}

{% tab title="Oracle" %}
Replace `<SCHEMA>` with the name of the schema that contains your SonarQube Server data.

```sql
BEGIN
  DBMS_STATS.GATHER_TABLE_STATS(
    ownname => '<SCHEMA>',
    tabname => 'CE_QUEUE',
    cascade => TRUE
  );
END;
/
```

{% endtab %}

{% tab title="Microsoft SQL Server" %}
Replace `<SCHEMA>` with the name of the schema that contains your SonarQube Server data.

```sql
UPDATE STATISTICS <SCHEMA>.ce_queue;
```

{% endtab %}
{% endtabs %}

Stop any queries on `ce_queue` still using the old query plan. Updating statistics does not change the query plan used by queries that were already running. You can terminate the running queries directly, or achieve the same effect by restarting either the database or SonarQube Server.

Then open **Administration** > **Projects** > **Background tasks** and check whether the number of pending tasks is going down.

### Step 4. Check for a large project blocking the queue

A single project with tens of thousands of components can monopolize Compute Engine for 30-60+ minutes. In **Administration** > **Projects** > **Background tasks**, look for one task that has been running much longer than the others.

If found:

* Consider cancelling it and re-triggering after fixing heap or DB (see steps 2-3)
* Review sonar.exclusions in that project's settings, generated code, test fixtures, dependencies, and build artifacts should be excluded

### Step 5. For Data Center Edition

* Verify every application node has at least one CE worker configured. A single shared worker across the cluster will cause queue buildup.
* After a rolling restart, confirm all nodes have rejoined the Hazelcast cluster (**Administration** > **System** > **Cluster**) before triggering new analyses.
* If you see *Task does not exist anymore* errors, this is a known race condition, failed tasks can safely be re-triggered.

### Still not resolved?

[Contact support](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/creating-support-ticket.md).

## Adjusting alert thresholds

For Monitoring alerts the default thresholds can be changed at any time without restarting the instance. See [Monitoring alerts](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/monitoring/monitoring-alerts.md) for more information.

## Related pages <a href="#related-pages" id="related-pages"></a>

* [Background task processing reference values](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/background-task-performance.md)
* [Server logs](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/server-logs.md)
* [Database-related issues](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/database-related-issues.md)
* [Elasticsearch-related issues](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/elasticsearch.md)
* [Other issues](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/other-issues.md)
* [Improving performance](https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/maintenance/improving-performance.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/server-update-and-maintenance/troubleshooting/performance-issues.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
