0

我们在 Heroku 上使用自动缩放器。几乎所有的请求都非常快(0-500 毫秒),但我们定期上传图片需要很长时间(3000-9000 毫秒)。在这种情况下,自动缩放根本没有帮助。是否有最佳实践来处理这个问题?例如,有没有办法从自动缩放器中省略特定的 URL?或者您是否通过设置一个并行应用程序来处理这些事务?

这是一个示例“慢”事务(标识符匿名)——所有时间都是完整的:

May 22 11:46:19 production heroku/router: at=info method=POST path="/api/users/cases/24070/case_posts.json" host=www.website.com request_id=XXX...XXX fwd="xxx.xxx.xxx.xxx" dyno=web.1 connect=0ms service=10483ms status=200 bytes=1762 protocol=https
Started POST "/api/users/cases/24070/case_posts.json" for xxx.xxx.xxx.xxx at 2018-05-22 18:46:10 +0000
Processing by Users::CasePostsController#create as JSON
  Parameters: {
    "image"=>#<ActionDispatch::Http::UploadedFile:0x00007f3068cb98d8 @tempfile=#<Tempfile:/tmp/RackMultipart20180522-11-1x9ayll.JPG>,
    @original_filename="IMG_1325.JPG",
    @content_type="image/jpeg",
    @headers="Content-Disposition: form-data; name=\"image\"; filename=\"IMG_1325.JPG\"\r\nContent-Type: image/jpeg\r\n">,
    "step"=>"pack out",
    ...
  }
  Rendered users/case_posts/_case_post.json.jbuilder (1.0ms)
  Rendering users/case_posts/show.json.jbuilder
  Rendered users/case_posts/_case_post.json.jbuilder (0.4ms)
  Rendered users/case_posts/show.json.jbuilder (1.0ms)
Completed 200 OK in 9120ms (Views: 1.8ms | ActiveRecord: 29.8ms)
4

0 回答 0