Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue due to large number of HEAD requests to S3 #2776

Open
muk-ai opened this issue Jan 20, 2025 · 3 comments
Open

Performance issue due to large number of HEAD requests to S3 #2776

muk-ai opened this issue Jan 20, 2025 · 3 comments

Comments

@muk-ai
Copy link

muk-ai commented Jan 20, 2025

description

I have updated carrierwave from 3.0.7 to 3.1.1 and am experiencing performance issues.

From what I can find, before CarrierWave::Storage::Fog::File#empty? was implemented, requests were not being sent to S3. This change seems to have caused the HEAD request to be sent to check for the existence of the file.

Is there any way to avoid sending this request or to cache it?

newrelic screenshots

Image

Many HEAD requests to s3 are being thrown.
Image

gems we use

  • carrierwave
  • fog-aws
  • grape
  • grape-active_model_serializers
  • active_model_serializers
@ayuto-takasaki-LITALICO
Copy link

ayuto-takasaki-LITALICO commented Jan 21, 2025

I also encountered the same problem, so I fixed the carrierwave version to 3.0.7 for now.
I found that on pages that include a check to see if an image has been saved, such as user.image?, the response time slows down by 0.5 seconds.
I am thinking that it could be fixed with user.image.url.present? etc., but it would be helpful if it is fixed on the gem side.

@muk-ai
Copy link
Author

muk-ai commented Jan 21, 2025

I am thinking that it could be fixed with user.image.url.present? etc.,

Thank you for sharing the workaround. I too am hoping for a fix on the gem side.

@loed-idzinga
Copy link

I've checked in our codebase, but the same issue is also present in version 3.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants