I have a simple app that receives POSTed images via an API and sends them to S3, via Carrierwave. My Photos table has a counter_cache as well.
80% of the time my transaction time is HUGE, like 60 seconds or more, and more than 90% of this time is spent uploading the image to S3 and updating counter_cache.
Does anybody have a clue about why this uploading time is so big and why counter cache queries are taking so long?
Just added some photos on http://carrierwave-s3-upload-test.herokuapp.com
Behavior was similar:
Just removed counter_cache
from my code and did some more uploading.... Odd behavior again.
EDIT 1
Logs from last batch upload. EXCON_DEBUG is set to True: https://gist.github.com/rafaelcgo/561f516a85823e30fbad
EDIT 2
My logs weren't showing any EXCON output info. So I realized I was using fog 1.3.1. Updated to Fog 1.19.0 (which uses a newer version of the excon gem) and everything works nicely now.
Tips.. If you need to debug external connections, use the newer version of excon and set the env EXCON_DEBUG=true in order to see some verbose, like this: https://gist.github.com/geemus/8097874
EDIT 3
Guys, updated the gem fog
and now it's sweet. Don't know why old versions of fog and excon have this odd performance.
EXCON_DEBUG=true
set? That will setup an instrumenter which will dump a lot more detailed info about what excon is doing out to the logs. I think that would give me much more to work with (though you should be cautious as it may require a bit of redaction before sharing). – Flawedconfig:add
on Heroku or as an ENV_VAR locally it should do the same thing. Seems like putting it on Heroku is more apt to get us the info we need here though. Thanks! – Flawed