I've been trying to improve performance our app. The worst performing area seems to be the creation of our Image model, which uses 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
...
We've already moved the move_to_s3 method to a delayed_job.
Our apdex score on this transaction is horrible (often < 0.5) and it's taking 1 to 2 seconds.
How else can I improve the creation of Image records (speed-wise)?
I may be able to do without the :small thumbnail? Would it help to drop that?
If it helps, most of these files are high-res images. Does the upload time factor into the metrics I have? Is it skewing the reports?
I would save the image directly to S3, then created a delayed job to download it, resize it, and put the thumbnails back in S3.
To show the image on the next page load, just link to the large version and resize it via css.
Also, yes, the fewer sizes you need, the less processing it will take.