jeudi 5 juin 2014

Rails 4 : ConnectionTimeoutError on heroku basic plan


Vote count:

0




We are working on a simple Rails 4 webapp, hosted by Heroku with the free plan.


Since we introduced real time notifications with Pusher, we are experiencing some ActiveRecord::ConnectionTimeoutError - one every few days - and we don't really understand the reasons behind it.


We know Heroku sets a pool limit of 20 connections to the Postgres db, and this is most likely the the reason why the exception is thrown. Anyway, there are many things we don't understand:




  1. What does the 20 actually mean? Is it the number of queries that the db can process at the same time? So, in case we have more than 20 users online we are in troubles? This seems strange, since even upgrading the Postgres plan we can get up to a pool of 200... which is not much!




  2. How can we debug this? The heroku logs don't give us enough line to get to source of the exception.




  3. Is there a way to monitor the number of connections to the db? Or, even better, to get the picks for each day?




  4. We set up a custom error 500 page, which works in most of the cases. However, with this exception and some few others, the server seems to loop an indefinite amount of time and request our custom paga again and again until the server crashes. Then, the only way to recover the website is through an heroku restart. Is there a way to avoid this behavior, so that an occurrence of the exception does not kill the website?




Any help and/or insight is greatly appreciated!



asked 53 secs ago

Abramodj

1,831





Aucun commentaire:

Enregistrer un commentaire