-1

I am experimenting with an upload action of a Rails application on my MacOS and a VPS context. On my MacOS I see:

Completed 200 OK in 462ms (Views: 0.2ms | ActiveRecord: 19.4ms)

However, on the VPS I get:

Completed 200 OK in 21762ms (Views: 0.1ms | ActiveRecord: 29.0ms)

The Rails action is just saving a file with paperclip, and the processing with rmagick looks like:


Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox1.png[0]'
Command :: identify -format %m '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox1.png[0]'
Command :: identify -format %m '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox1.png[0]'
Command :: convert '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox1.png[0]' -auto-orient -resize "100x" -crop "100x100+0+0" +repage '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox120130127-3196-16s5ce0'
Command :: file -b --mime '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox120130127-3196-16s5ce0'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox1.png[0]'
Command :: identify -format %m '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox1.png[0]'
Command :: identify -format %m '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox1.png[0]'
Command :: convert '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox1.png[0]' -auto-orient -resize "50x" -crop "50x38+0+6" +repage '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox120130127-3196-1n2s0ck'
Command :: file -b --mime '/var/folders/dp/d61_ggqs0zvg9dcnybvfjgb40000gn/T/Bildschirmfoto 2013-01-27 um 16.39.0020130127-3196-8zjox120130127-3196-1n2s0ck'

What's going on?

poseid
  • 6,986
  • 10
  • 48
  • 78
  • 3
    Can you post the specs for your Mac and the VPS? It's probably that your VPS has a slower CPU, etc. – Peter Brown Jan 27 '13 at 22:36
  • the problem, and possible solution is also described here: http://johannes.jarolim.com/blog/2011/11/21/extreme-slow-imagemagick-on-vps-with-ubuntu/ - apparently it's a problem with some Library on Ubuntu – poseid Jan 31 '13 at 07:00
  • another similar thread with speed problems: http://stackoverflow.com/questions/5397683/upload-with-paperclip-very-slow-unicorn – poseid Jan 31 '13 at 17:15

1 Answers1

1

It's impossible to give a definite answer without more information, but:

  1. When you are testing an upload action locally, the time spent transferring the file will be ~0. When you try on the actual server, some time will be spent transferring data (how much time depends on how fast your Internet connection is). The developer tools in Chrome can show you how much time this is taking.

  2. I don't know which provider you are using for hosting, but in the past I have found S3 (for one) to have very sluggish performance as compared to my dev machine. (A 10x difference is rather extreme, though.)

  3. Have you tried running a few image-resizing commands from the command line with ImageMagick? (BTW, I believe that Paperclip invokes ImageMagick using shell commands, not through RMagick.) Try that and see if it seems unusually slow.

  4. Profile the action and make sure that the problem is not caused by some other code in your application.

  5. If the problem really seems to be coming from ImageMagick, check the versions which you have installed locally and on the VPS.

Alex D
  • 29,755
  • 7
  • 80
  • 126