[英]heroku redis connection issues using sidekiq
I am using Sidekiq to process jobs. 我正在使用Sidekiq处理作业。 I am using Heroku basic plan which allows up to 40 connections.
我正在使用Heroku基本计划,该计划最多允许40个连接。 My understanding is that each thread can have up to 1 connection.
我的理解是,每个线程最多可以有1个连接。 Sidekiq has a default number of threads of 25. In my thinking I should never be getting more than 25 connections.
Sidekiq的默认线程数为25。在我看来,我永远都不会超过25个连接。
But I have been getting too many connections errors to redis. 但是我收到太多的连接错误,无法重做。 How would this be posible?
这怎么可能? Should I cut down the number of Sidekiq workers?
我应该减少Sidekiq工人的数量吗? Or is there something else I can do?
还是我还能做些其他事情? I currently have my Procfile like this:
我目前有这样的Procfile:
worker: bundle exec sidekiq
Would switching it to this fix it? 会切换到此修复程序吗?
worker: bundle exec sidekiq -c 10
Is it possible Sidekiq is not closing connections properly? Sidekiq是否可能无法正确关闭连接? Also, when I get this "too many connections" error, it basically brings down the site - is there a way to let if fail gracefully which it seems like it should do.
另外,当我收到此“连接过多”错误时,它基本上使该站点瘫痪了-有一种方法可以让它正常运行(如果失败),这似乎应该做到。
The short answer was that heroku wasn't accurately showing the number of connections which was tripping up any debugging. 简短的答案是,heroku不能正确显示导致调试失败的连接数量。 And I was pretty amateurish in figuring it out since Redis has pretty much worked.
由于Redis的工作原理相当不错,所以我很业余。
My timeout was set to zero (determined via > heroku redis:info
) which basically meant that connections are held open indefinitely (the dashboard didn't show this accurately saying I was using like 10 when really having like 35). 我的超时设置为零(通过>
heroku redis:info
来确定),这基本上意味着连接会无限期保持打开状态(仪表板没有准确显示这一点,当我真正拥有35时,我正在使用10。
Connecting to redis via heroku redis:cli and then running >CLIENT LIST
showed the problem where there were many connections / clients probably in like TIME_WAIT state. 通过heroku redis:cli连接到Redis,然后运行
>CLIENT LIST
显示了很多连接/客户端可能处于TIME_WAIT状态的问题。
changing the timeout fixed this: 更改超时可以解决此问题:
heroku redis:timeout --seconds 60
Honestly, calling it a connection pool is a big inaccurate. 坦白地说,将其称为连接池是一个很大的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.