Serving resized S3 images on the fly

#9 Protecting from Concurrent Access

.com software
3 min readSep 9, 2022
Photo by Brendan Church on Unsplash

If you didn’t notice — this is part of a series

Today we are to tackle the problem of concurrent access and how it could lead to the app being overwhelmed with requests.

Imagine a freshly generated link for an image that has never been downloaded from AWS and never had a thumbnail generated.

The address to generate such a thumbnail goes to the home page of a popular website. This website happens to serve constantly about 1000 people.

As soon as the link is published, everybody starts requesting the thumbnail of the image.

Effectively, this means 1000 image requests to the AWS for the source. In the case of a 7Mb large image, we are talking about almost seven gigabytes of wasted transfer!

Then the server would launch the Imagick converter. Can you guess how many times? Such traffic would generate a CPU spike that would cause a self-DDoS attack and effectively block the server.

Photo by marcos mayer on Unsplash

Introducing…

--

--

.com software

Father • PHP developer • entrepreneur • working for a €1bn unicorn startup as a backend engineer >>> https://bit.ly/dotcom-software