ruby on rails - AWS S3 404 errors slowing down performance significantly -
i'm uploading images rails app directly s3. when load index page shows images, retrieving image url directly s3.
what i'm trying check if s3 image exists using 'exists?' method in api documentation, , if image exists, show image, , if doesn't exist, show default image that's stored in asset pipeline.
i'm able this, performance becomes slow (10 sec load time!) , logs, due 404 keynotfound errors returns images don't exist. when retrieve images without doing exists? check, page loads faster (less 1 sec - images aren't there blanks on web page).
how can around this? show default image in case of missing image.
store images on s3, keep view fragment caches containing images on server.
the first page access tries show image incur cost, thereafter, cache hits mitigate response time other attempts show image.
with relatively simple fragment cache management logic, can work out quite caching pieces of views take "too time" assemble.
the models views being cached responsible expiring caches containing data - when model instance's cached data changed, blows away cached data fragments show piece of data -- not cached views showing data, affected.
i've used different fragment caches index views, show views, , when model's data appears in "related items view" of different model.
Comments
Post a Comment