3

I am using CarrierWave for image uploading, and the uploads take anywhere from 3-5 seconds (in production) using Rackspace Cloudfiles as the store. At first, I attributed it to my image processor being slow or awkward, or something; so, I switched from RMagick to Vips... No perceptible change in speed.

Needing more information, I decided to write some New Relic instrumentation:

http://github.com/tehprofessor/newrelic-carrierwave

After using the instrumentation, New Relic is reporting that the majority of each request (85% on average) is spent inside of:

::CarrierWave::Storage::Fog::File#store

The #store method is being called multiple times, sometimes the first is slow, sometimes the last, sometimes each of them. On average the quickest calls to #store complete in about 234ms.

I am currently making 5 versions; each of which completes in less than 10ms (for image processing). The source files are between 100k and 500k.

So in short, it's definitely something with posting to Rackspace. Nothing to do with the image library.

My CarrierWave configuration

CarrierWave.configure do |config|
    config.fog_credentials = {
        :provider           => 'Rackspace',
        :rackspace_username => 'SECRET_SAUCE',
        :rackspace_api_key  => 'CHEESEBURGER',
        :rackspace_servicenet => true
    }
    config.storage = :fog
end

I've contacted Rackspace and their support suggested using Curl. The support rep who was "trying" to help me found that using Curl the cloud files were consistently fast. I found that particularly not helpful, and in sharp contrast with what my New Relic instrumentation suggests.

Also, the containers I am using are public, and located in the same data center as our cloud servers (VPS).

At this point I'm pretty much at a loss for why this is so damn slow; especially since I have the servicenet set and the container and servers are in the same data center. If anyone has any suggestions, or ideas I would love to hear them...

Perhaps I've just done something very stupid or missed a configuration option? Any help is much appreciated!

Update: A year later this is still an issue; though not as bad-- maybe Rackspace changed something?

Thank you, Seve

tehprofessor
  • 2,957
  • 1
  • 21
  • 22

0 Answers0