Sidekiq is consuming too much memory

Since updating to latest yesterday I’ve been seeing this error in the logs constantly. My server has 8gb of ram and only 60% used. I tried running discourse-setup to reset my settings, which gave me this:

setting db_shared_buffers = 2048MB


Message (781 copies reported)

Sidekiq is consuming too much memory (using: 510.87M) for '', restarting


config/unicorn.conf.rb:164:in `check_sidekiq_heartbeat'
config/unicorn.conf.rb:244:in `master_sleep'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:295:in `join'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/unicorn-6.1.0/bin/unicorn:128:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/3.2.0/bin/unicorn:25:in `load'
/var/www/discourse/vendor/bundle/ruby/3.2.0/bin/unicorn:25:in `<main>'

Any ideas what may be going on here?


Increase the Sidekiq memory fixed it for me.


If it’s any consolation I get this too, fairly regularly.

I’ll investigate @Don’s suggestion. I did wonder! Now I know!


That seems to have done the trick, thank you Don!


Is this a case of “not enough headroom” or do we think this is a memory leak of some kind?

If the latter then surely this error will pop up anyway and increasing the memory allocated will just reduce the error frequency …

FWIW I still haven’t seen the error and my memory usage went up about 400 MB after changing this setting.

1 Like

I’m a wondering this:

I get same error ( or should it count more as informative?) and mine is not multisite nor busy.

Is achitecture changed over the times and we are near old topic do we need more menory than told?

1 Like

This warning appeared in my /logs after I actived YJIT but there is a note it is increase memory usage. However I think it can also happen busy sites with lots of activity or busy shared servers with shared memory etc…


the Sidekiq dashboard appears to show memory use for Redis, shame it doesn’t do the same for Sidekiq itself?:

Just a little update here, since making the change my memory usage jumped from around 60% to 80% (8 GB) and holding steady. I haven’t seen another error in the logs and some other issues have cleared up as well.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.