搜索我的数据库时,heroku错误导致数据库过载

时间:2015-10-11 19:22:43

标签: heroku heroku-postgres

我已经粘贴了我的heroku日志...我的应用程序加载正常,但当我进行搜索时,我总是收到错误。我在想DB正在过载,但不确定发生了什么......任何帮助都会很棒!

   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 scheduler@addons.heroku.com 
    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)  

1 个答案:

答案 0 :(得分:0)

如果您有免费的爱好Heroku Postgres plan,那么您只能使用20个连接。也许你的rails scraper进程打开了太多连接。

您可以使用Heroku Toolbelt中的heroku pg:diagnose命令来诊断应用程序查询到数据库的性能问题。这会运行多个diagnostic checks on your database并生成一个显示潜在问题点的报告。

如果您的计划不是业余爱好,那么您还会获得expensive queries  在您的数据库的Heroku仪表板中报告。