0

(Rails 3.2 on Heroku)

For handling image uploads in Rails I switched from Paperclip to Dragonfly because I like to be able to generate thumbnails dynamically, when they are requested for the first time.

However, it seems that uploading of attached files to S3 (using S3DataStore) is much slower than with Paperclip

This is how an upload looks in a NewRelic transaction trace: trace

Anyone have experience in speeding this up?

levinalex
  • 5,889
  • 2
  • 34
  • 48

1 Answers1

0

That's a really surprising benchmark; is the server doing the file uploading on EC2 and also in the same region as your S3 bucket? How big are the generated thumbnails?

Those questions aside, doing any kind of thumbnail generation during a response is probably not a great idea: it'll add some time to each page load where thumbnails need to be generated, and even if that time isn't 3 seconds it'll still be something. I'd process images asynchronously with a gem like Delayed Paperclip. Though you won't save on storage space, as you would with CarrierWave, your response times will be vastly improved.

Veraticus
  • 15,944
  • 3
  • 41
  • 45
  • this is on upload. serving thumbnails works great and is plenty fast. – levinalex Nov 01 '12 at 16:39
  • with delayed paperclip there is a window where thumbnails are missing. I want to avoid that. – levinalex Nov 01 '12 at 16:45
  • heroku lives on us-east, our s3 bucket is on eu-west. While this is bad and I'll fix that, this still does not explain the performance regression from when I used paperclip on the otherwise identical setup. – levinalex Nov 01 '12 at 16:49