Closed dashbitla closed 8 years ago
Look like that error is thrown from here, among other places.
If your pool is 20, and you have 6 different jobs, is it possible, all connections are being check out? Usually when that's a case, you get a different error that says it can't establish a connection in a certain amount of time.
Also, you might want to check the number of connections in use as your application is running to ensure they're being checked back in.
Tried with pool size as 100 also. All other Jobs set their workers limit to just 2, the default. So total connections if we really see it, it should not be more than 14 connections for these workers - even if all of them running concurrently.
Is it to do with multiple database connections where SMS is picked form one database, pushed via HTTP API Call and then updated in an other SMS common database as specified in the database.yml?
OR Is it to do with Passenger by any chance? Is there something need to be configured for this?
Honestly, I'm not sure. It sounds application-specific. I wish I could give you more guidance, but I've not come across this error before. Definitely sounds like you're headed down the right path with the DB configuration though.
On Tue, Mar 15, 2016 at 4:38 PM, Dash Bitla notifications@github.com wrote:
Tried with pool size as 100 also. All other Jobs set their workers limit to just 2, the default. So total connections if we really see it, it should not be more than 14 connections for these workers - even if all of them running concurrently.
Is it to do with multiple database connections where SMS is picked form one database, pushed via HTTP API Call and then updated in an other SMS common database as specified in the database.yml?
OR Is it to do with Passenger by any chance? Is there something need to be configured for this?
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/brandonhilkert/sucker_punch/issues/168#issuecomment-197010533
Is it to do with Passenger configuration by any chance? Is there something need to be configured for the Passenger environment?
I haven't used Passenger in a long time, so I don't know if that has something to do with it. Perhaps you could try Unicorn/Puma and see if it the problem persists.
When we are running the application under Passenger with 40 processes and 10 servers, thats like 400 processes capacity for these workers to utilize.
The simplest solution for Passenger or any multi-process based environments with multiple processes running, we can limit the workers to 1 or 2 is good enough I feel. This works for us, as we use all the Passenger processes across all the servers to handle sucker_punch jobs!
In our case - I just reduced workers per job to 1 for less frequent jobs and 2 for frequent jobs and things are perfectly back on track. In our case it means, a Job can run as many as 400 workers.
Also I have factored the Pool Size and also MySQL max_connections to support these connections.
Thanks for all the clarifications Brandon.
Thanks for the Awesome sucker_punch Gem. Really LOVE :heart: it.
_Moving away from Sidekiq & Redis and good saving on Workers servers and better utilization of the App Servers. Planning to switching to MemCached for Cache and try to leverage MemCached direct from MySQL 5.6. A BIG THANK YOU :heart: :green_heart: _
:+1: Happy to help. Good luck :)
We are using sucker_punch latest 2.0 Gem for SMS processing! It fails with ActiveRecord::ConnectionNotEstablished error as given below.
database.yml configuration:
Here is the Code:
The above code pulls the SMS object details from the database and calls an HTTP API to send the SMS and updates an SMS Database Table which is in a different database on the same database server.
The application is running under Passenger 4.0 version with NGinx.
This happens for about 10% of the Jobs and its also causing the effect on main application actions to have the same Connection issue.
Never had this issue before.
By the way, we have about 6 different sucker_punch jobs that does different things.
Any thoughts on whats going on?