Search code examples
herokuheroku-postgres

heroku error when searching my DB is this the DB getting overloaded


i have pasted my heroku logs below...my app loads fine but when I do a search I always get a error. I am thinking that the DB is getting overload but not really sure what is happening..any help would be great!

   Oct 11 12:19:25 duckduckjeep app/web.1:  Processing by PostsController#index as HTML 
    Oct 11 12:19:25 duckduckjeep app/web.1:    Parameters: {"utf8"=>"✓", "model"=>"", "max_price"=>"", "zip_code"=>"", "distance_radius"=>"20"} 
    Oct 11 12:19:27 duckduckjeep app/web.1:    Rendered posts/_filter.html.erb (3.0ms) 
    Oct 11 12:19:29 duckduckjeep heroku/api:  Starting process with command `bundle exec rake scraper:scrape` by [email protected] 
    Oct 11 12:19:45 duckduckjeep heroku/scheduler.1200:  Starting process with command `bundle exec rake scraper:scrape` 
    Oct 11 12:19:46 duckduckjeep heroku/scheduler.1200:  State changed from starting to up 
    Oct 11 12:19:50 duckduckjeep app/scheduler.1200:  rake aborted! 
    Oct 11 12:19:50 duckduckjeep app/scheduler.1200:  OpenURI::HTTPError: 500 Internal Server Error 
    Oct 11 12:19:50 duckduckjeep app/scheduler.1200:  /app/lib/tasks/scraper.rake:31:in `block (3 levels) in <top (required)>' 
    Oct 11 12:19:50 duckduckjeep app/scheduler.1200:  /app/lib/tasks/scraper.rake:12:in `loop' 
    Oct 11 12:19:50 duckduckjeep app/scheduler.1200:  /app/lib/tasks/scraper.rake:12:in `block (2 levels) in <top (required)>' 
    Oct 11 12:19:50 duckduckjeep app/scheduler.1200:  Tasks: TOP => scraper:scrape 
    Oct 11 12:19:50 duckduckjeep app/scheduler.1200:  (See full trace by running task with --trace) 
    Oct 11 12:19:50 duckduckjeep heroku/scheduler.1200:  Process exited with status 1 
    Oct 11 12:19:52 duckduckjeep heroku/scheduler.1200:  State changed from up to complete 
    Oct 11 12:19:55 duckduckjeep heroku/router:  at=error code=H12 desc="Request timeout" method=GET path="/posts?utf8=%E2%9C%93&model=&max_price=&zip_code=&distance_radius=20&distance_radius=20" host=duckduckjeep.herokuapp.com request_id=c040a54a-c05f-4ee9-b984-2b64d72a8581

 fwd="173.75.43.19" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 
Oct 11 12:20:07 duckduckjeep app/web.1:    Rendered shared/_header.html.erb (0.4ms) 
Oct 11 12:20:07 duckduckjeep app/web.1:    Rendered posts/index.html.erb within layouts/application (39773.8ms) 
Oct 11 12:20:07 duckduckjeep app/web.1:  Completed 200 OK in 42131ms (Views: 134.6ms | ActiveRecord: 40072.8ms) 
Oct 11 12:20:07 duckduckjeep app/web.1:    Rendered shared/_footer.html.erb (0.0ms)  

Solution

  • If you have a free Hobby Heroku Postgres plan then you are limited to 20 connections. Perhaps your rails scraper process is opening too many connections.

    You can use heroku pg:diagnose command from the Heroku Toolbelt to diagnose performance issues with your application queries to the database. This runs several diagnostic checks on your database and generates a report showing potential problem spots.

    If you have a plan other than hobby, you also get an expensive queries report in the Heroku dashboard for your database.