# Issue: Extremely Slow Sidekiq Processing After Large Imports on Multisite Instance

**URL:** https://meta.discourse.org/t/issue-extremely-slow-sidekiq-processing-after-large-imports-on-multisite-instance/363185
**Category:** Support
**Created:** [April 23, 2025, 5:10pm UTC](https://meta.discourse.org/t/issue-extremely-slow-sidekiq-processing-after-large-imports-on-multisite-instance/363185 "2025-04-23T17:10:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![emonunix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/emonunix/32/485652_2.png) [@emonunix](https://meta.discourse.org/u/emonunix)
#### Post date: [April 23, 2025, 5:10pm UTC](https://meta.discourse.org/t/issue-extremely-slow-sidekiq-processing-after-large-imports-on-multisite-instance/363185/1 "2025-04-23T17:10:59Z")

</div>

We’re running several Discourse sites with multisite under a single app. Recently, we did a batch of large user imports (hundreds of thousands of users across 6 sites). After the imports, Sidekiq is processing background jobs very slowly. The Sidekiq dashboard shows a huge backlog, and jobs are clearing at a much slower rate than expected.

**Environment details:**

- The VM was upgraded to 16 CPUs / 16GB RAM.
- However, in the Sidekiq interface, we only see 5 threads and it seems like only a small portion of the resources are being used.
- The main import queue (“nursingjobs” as multisite parent) is handling jobs for all the child sites, but job throughput is very low.
- Server metrics: CPU sometimes at 80–90%, memory at around 6.7/7.2GB.

**We’re looking to:**

- Speed up Sidekiq/background job processing to clear large backlogs post-import.
- Ensure Discourse is making use of all the available resources (CPU/RAM).
- Understand if there are thread/process limits that need adjustment.

### Questions:

1. What’s the best way to configure Sidekiq/Discourse for high-throughput post-import?
2. What are the recommended settings for UNICORN\_SIDEKIQS and DISCOURSE\_SIDEKIQ\_WORKERS on large multi-core systems?
3. Are there Postgres or other app.yml settings we should tweak to avoid DB pool errors when raising Sidekiq concurrency?
4. Any best practices for clearing huge Sidekiq backlogs quickly and safely after imports?

 ![The image displays a Sidekick.io dashboard showing process counts, failed instances, latency, and three queued tasks, each with options for deletion. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/4/6/2/4627f632902e333266e74750bf31df1b8b122a2d.jpeg)

Sidekiq stats/screenshots available if helpful!

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [April 23, 2025, 6:41pm UTC](https://meta.discourse.org/t/issue-extremely-slow-sidekiq-processing-after-large-imports-on-multisite-instance/363185/3 "2025-04-23T18:41:24Z")

</div>

The answer to all of those questions is, more or less, cranking up `DISCOURSE_SIDEKIQ_WORKERS`.

I would crank that up to maybe 32 since you know you have a lot of spare CPU available. If you still have lots of CPU available after that’s been running for a while, feel free to crank it up more.

You could probably drop that back down to, say, 8 or 12 for normal operation.

Make sure you have enough `max_connections` for postgres. You’ve probably already bumped it up since you’re running multisite, but keep an eye on it.

---

<div class="post-metadata">

### Author: ![emonunix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/emonunix/32/485652_2.png) [@emonunix](https://meta.discourse.org/u/emonunix)
#### Post date: [April 23, 2025, 7:56pm UTC](https://meta.discourse.org/t/issue-extremely-slow-sidekiq-processing-after-large-imports-on-multisite-instance/363185/4 "2025-04-23T19:56:33Z")

</div>

Thanks @supermathie it’s working now.  
I updated config to below

```plaintext
  UNICORN_WORKERS: 8
  UNICORN_SIDEKIQS: 7
  DISCOURSE_SIDEKIQ_WORKERS: 10
  DISCOURSE_DB_POOL: 20

```

And increased CPU to

```plaintext
8vCPU
16GB Memory

```
