# Sidekiq is consuming too much memory even with UNICORN\_SIDEKIQ\_MAX\_RSS adjusted

**URL:** https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [October 31, 2023, 1:50pm UTC](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010 "2023-10-31T13:50:48Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 31, 2023, 1:50pm UTC](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010/1 "2023-10-31T13:50:48Z")

</div>

Continuing the discussion from [Sidekiq is consuming too much memory, restarting](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-restarting/48395/40):

> [@Sidekiq is consuming too much memory, restarting](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-restarting/48395/40):
>
> Except for that, yes, on mega busy multisites you need to adjust `UNICORN_SIDEKIQ_MAX_RSS`

I’ve adjusted the setting and see this in the container:

```plaintext
root@ip-10-4-2-52:/# set|grep SIDE
UNICORN_SIDEKIQS=1
UNICORN_SIDEKIQ_MAX_RSS=1000

```

But I see this in the logs:

```plaintext
Sidekiq is consuming too much memory (using: 535.10M) for 'site', restarting

```

It would seem like 535.10M \< 1000, right? I feel like I must have a typo or something else really silly.

This is a very busy site with 600-800K pageviews/day with 7 (largely idle) web containers running in ECS.

There are 4 CPUs in the task, should I increase `UNICORN_SIDEKIQS`?

If I run `[ENV["UNICORN_SIDEKIQ_MAX_RSS"].to_i, 500].max.megabytes` in rails, I get `1048576000`, so it seems like Rails should have access to the ENV, but maybe running rails myself is somehow different from the one that gets cranked up on boot?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 31, 2023, 8:56pm UTC](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010/2 "2023-10-31T20:56:13Z")

</div>

it looks like you are doing the right thing… if you raise `UNICORN_SIDEKIQS` to 2 do you see 2 sidekiqs?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 31, 2023, 11:49pm UTC](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010/3 "2023-10-31T23:49:08Z")

</div>

I’ll try increasing the number of sidekiq next, but I’m confused that it says 538 mb is to much when it’s set for 1000.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 31, 2023, 11:51pm UTC](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010/4 "2023-10-31T23:51:05Z")

</div>

Agree, just want to see that at least one of the env vars is “sticking”

---

<div class="post-metadata">

### Author: ![sandra.mccollum](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sandra.mccollum/32/441742_2.png) [@sandra.mccollum](https://meta.discourse.org/u/sandra.mccollum)
#### Post date: [December 7, 2024, 2:17pm UTC](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010/5 "2024-12-07T14:17:48Z")

</div>

Was there any resolution to this, as I see in my logs:

Sidekiq is consuming too much memory (using: 501.37M) , restarting

UNICORN\_SIDEKIQ\_MAX\_RSS: 1000

and the site is not a very busy one

What else should I try?

---

<div class="post-metadata">

### Author: ![sandra.mccollum](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sandra.mccollum/32/441742_2.png) [@sandra.mccollum](https://meta.discourse.org/u/sandra.mccollum)
#### Post date: [December 13, 2024, 12:53pm UTC](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010/6 "2024-12-13T12:53:52Z")

</div>

Is this a Sidekiq issue, and whether it is nor not, will this issue be fixed?

Job exception: MiniScheduler::DistributedMutex::Timeout  
We 6:21 pm

```plaintext
mini_scheduler-0.17.0/lib/mini_scheduler/distributed_mutex.rb:43:in `synchronize' 
mini_scheduler-0.17.0/lib/mini_scheduler/distributed_mutex.rb:15:in `synchronize' 
mini_scheduler-0.17.0/lib/mini_scheduler/manager.rb:365:in `lock' 
mini_scheduler-0.17.0/lib/mini_scheduler/manager.rb:316:in `tick' 
mini_scheduler-0.17.0/lib/mini_scheduler.rb:76:in `block (2 levels) in start' 

```

Posted by NateDhaliwal:

 ![The image shows a code snippet from the GitHub repository "discourse" containing code related to the Sidekiq job scheduler, with a question about whether it might be a Sidekiq issue. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/3/e/c/3ec551cfb5ceb8b994508446e7cb46433a53d8ab.png)

---

<div class="post-metadata">

### Author: ![haydenjames](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haydenjames/32/255678_2.png) [@haydenjames](https://meta.discourse.org/u/haydenjames)
#### Post date: [October 9, 2025, 2:29pm UTC](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-even-with-unicorn-sidekiq-max-rss-adjusted/284010/7 "2025-10-09T14:29:39Z")

</div>

@sandra.mccollum I also have [a similar issue](https://meta.discourse.org/t/sidekiq-is-consuming-too-much-memory-using-522-12m-restarting/385130).

Were you able to solve?
