Home>
About speeding up Rails apps on Heroku

I run an app like a blog site on Heroku, but I upload a couple of images to S3 on AWS in one post.
Previously, I used the gems CarrierWave, fog, and minimagick, but when I gave 3 images, the time was down.

Therefore, I stopped using the gems CarrierWave, fog, and minimagick, and changed to upload images directly to S3 by referring to the following article. (Uploading images took about 10 seconds even with 3 images.)

Reference article: https://qiita.com/DaichiSaito/items/80e89f0c96d88afcc5ff
Reference article: https://devcenter.heroku.com/articles/direct-to-s3-image-uploads-in-rails

Even if I give 3 images, the time is not down, but when I press the post button after uploading the images,
Even though the image has already been uploaded to S3 on AWS, it takes about 30 seconds to complete the posting.
The file size of the image is an image taken with a smartphone, so each image has about 1 to 3 MB.

If i do exactly the same process in the local development environment, the image upload will be completed in about 10 seconds, and the posting will be completed in about 2 seconds.

I thought that the time was down and it took a long time because the image upload process was heavy.
Why does it take about 30 seconds to complete the post even though the image has already been uploaded to S3 on AWS?

Also, how can I speed up the posting process?
I'm currently using the free version of Heroku, will it improve if I change to a paid version of the plan?

By the way, Heroku is said to be slow because the server is in the United States, but I don't think that is the cause because the display speed of pages other than posting processing is fast.

Please give us your advice.

  • Answer # 1

    I'm sorry it's not a direct answer, but ...

    I'm currently using the free version of Heroku, will it improve if I change to a paid version of the plan?

    We recommend that you change Heroku to a Hobby plan once.
    So it's a good idea to run a test to see if it works as expected.
    The reason is that Heroku is billed in seconds.
    (The Hobby plan is $7/month, so it shouldn't cost you 30 yen even if you run it a day.)