Closed jgrau closed 7 years ago
I think I've resolved this issue and perhaps discovered a bug(?):
Without specifying the :connection
option sneakers
will generate a connection for every worker each with one channel open. In my application that is about 50 workers which opened 50 connections to rabbitmq. Using a service like CloudAMQP that would fail after about 40 connections. For example I tried running the following in the rails console
50.times { Bunny.new(ENV['CLOUDAMQP_URL']).start }
It would make a bunch of connections and then raise an exception.
Solution: Setting the configuration option :connection
(in my case to Bunny.new(ENV['CLOUDAMQP'])
) instead makes sneakers
open 1 connection to rabbitmq with 50 channels which generally seems more appropriate.
From looking at the sourcecode it seems workergroup
is iteration over each worker which generates a new Queue
and that queue opens a new bunny connection (unless the configuration :connection
is set).
@jgrau this is not very well documented and can be made more efficient but it can be argued that the current approach also has benefits and is more straightforward in some ways.
@jondot @gabrieljoelc WDYT about introducing a way for worker groups to use a shared connection?
I updated the docs to mention both the connection
option and connection sharing (or lack of).
I could swear there was a PR that added shared connection support and sure enough, it's #266 by @mikebobrov :)
First of all thanks for an awesome gem - we use it extensively on our platform.
We are hosted on Heroku and use CloudAMQP. I am trying to debug an issue we see on every deploy/restart of our workers. The workers fail to connect for up to 20 minutes then suddenly connects correctly. I have been working with CloudAMQP and Heroku support on this and received the following thorough response from Heroku:
My config:
I realize that this is probably not directly a sneakers issue so I guess it's more of a question about whether this rings any bells or whether someone knows of an aggressive timeout being set.
Thanks for a great gem!