我一直在努力提高我们的应用程序的性能。表现最差的领域似乎是我们的 Image 模型的创建,它使用了 attachment_fu:
class Image < Attachment
...
has_attachment :content_type => :image,
:max_size => 100.megabytes,
:storage => :file_system,
:path_prefix => 'public/uploaded/images',
:thumbnails => { :small => '75x75>', :medium => '160x120>', :large => '600x600>' },
:s3_access => :authenticated_read
validates_as_attachment
after_create :move_to_s3
...
我们已经将 move_to_s3 方法移到了延迟作业中。
我们在这个事务上的 apdex 分数很糟糕(通常 < 0.5),而且需要 1 到 2 秒。
我还能如何改进图像记录的创建(速度方面)?
我也许可以不用 :small 缩略图?放弃它会有帮助吗?
如果有帮助,这些文件中的大多数都是高分辨率图像。上传时间是否会影响我拥有的指标?是歪曲报道吗?