我们在 Heroku 上的暂存服务器上遇到了一个有趣的问题。每个 post/put/delete 请求都会冻结大约 10 秒或更长时间,其中一些最终会超时,从而导致 Heroku H-12 超时错误。另一个有趣的细节:请求似乎在超时后被处理,因为数据库记录得到更新。我们不处理大数据,我们只是尝试更新数据库中一条记录上的一个字段。我们的本地环境(localhost:3000)工作正常。我们没有任何阻止操作(发送电子邮件、处理大型查询……)我们尝试过激活/停用缓存(dalli)、资产编译,我们已经切换了登台服务器的实例。我们在 staging.rb 中尝试了不同的设置。
关于我们如何尝试解决此问题的任何建议?
2012-10-08T21:32:15+00:00 app[web.1]: Started PUT "/users/151" for 67.180.34.143 at 2012-10-08 21:32:15 +0000
2012-10-08T21:32:15+00:00 app[web.1]: Processing by UsersController#update as HTML
2012-10-08T21:32:15+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"n4xK0Esi2zgBqSRtDTu3IEhnUAv0//bAkjLnKyk7xFk=", "user"=>{"role"=>"2", "designer_status"=>"1", "invitation_limit"=>"56"}, "commit"=>"Update", "id"=>"151"}
2012-10-08T21:32:45+00:00 heroku[router]: Error H12 (Request timeout) -> POST ziba-exygy-2.herokuapp.com/users/151 dyno=web.1 queue= wait= service=30000ms status=503 bytes=0
2012-10-08T21:32:46+00:00 app[web.1]: Redirected to https://ziba-exygy-2.herokuapp.com/users
2012-10-08T21:32:46+00:00 app[web.1]: Completed 302 Found in 30304ms (ActiveRecord: 53.7ms)
2012-10-08T21:32:46+00:00 app[web.1]: cache: [POST /users/151] invalidate, pass
2012-10-08T21:32:46+00:00 app[web.1]: User Load (3.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 42 LIMIT 1
2012-10-08T21:32:46+00:00 app[web.1]: User Load (12.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 151 LIMIT 1
2012-10-08T21:32:46+00:00 app[web.1]: (2.8ms) BEGIN
2012-10-08T21:32:46+00:00 app[web.1]: User Exists (3.2ms) SELECT 1 FROM `users` WHERE (`users`.`email` = BINARY 'pierre+tttttttttt@blablabla.com' AND `users`.`id` != 151) LIMIT 1
2012-10-08T21:32:46+00:00 app[web.1]: (3.1ms) COMMIT
2012-10-08T21:32:46+00:00 app[web.1]: (2.7ms) BEGIN
2012-10-08T21:32:46+00:00 app[web.1]: CACHE (0.0ms) SELECT 1 FROM `users` WHERE (`users`.`email` = BINARY 'pierre+tttttttttt@ blablabla.com' AND `users`.`id` != 151) LIMIT 1
2012-10-08T21:32:46+00:00 app[web.1]: (11.6ms) UPDATE `users` SET `invitation_limit` = 56, `updated_at` = '2012-10-08 21:32:31' WHERE `users`.`id` = 151
2012-10-08T21:32:46+00:00 app[web.1]: (2.9ms) COMMIT