Heroku rails timeouts with S3 memory

I have an application using rails 3.2 running on a hero and stored on S3. Users have the ability to upload photos that are processed using the carrier / MiniMagick for different sizes.

The problem that we see is that in 30% of cases the browser is turned off. The upload code (there are up to four images that can be uploaded) is as follows: I use carrierwave_backgrounder to delay image manipulation, but we still have timeouts. This is with fairly small images - usually 150 KB PNG.

mount_uploader :image1, ImageUploader process_in_background :image1 mount_uploader :image2, ImageUploader process_in_background :image2 mount_uploader :image3, ImageUploader process_in_background :image3 mount_uploader :image4, ImageUploader process_in_background :image4 

This is the mistake we see

 app[web.1]: Started POST "/offices" for 197.16.140.27 at 2013-05-23 23:32:18 +0000 app[web.1]: E, [2013-05-23T23:32:49.042937 #2] ERROR -- : worker=0 PID:10 timeout (31s > 30s), killing 

The same thing happens with the subtle and the unicorn.

The reading I did suggests that I should upload directly to S3, but then the image processing is delayed, which is a problem for me (latency / complexity). What should I do differently?

+4
source share
2 answers

John is right: this is what happens when you load directly into the hero. I wrote about some strategies for transferring hero downloads here .

+2
source

This is a common download problem and something that can only be resolved by downloading directly to S3 and processing after completion. The problem you are facing is the connection speed with the user, if it comes from a cell phone, it will take a long time to 30 seconds compared to the same file that was downloaded from someone on a fast Internet connection. You are not doing anything wrong, different servers will not matter, I'm afraid.

+1
source

Source: https://habr.com/ru/post/1482486/


All Articles