Bad Cloud Architecture at Dinner

Posted on November 23, 2022 by Michael Keane Galloway

Last night I went out to dinner with my Wife. We’ve rarely gone out to dine at restaurants since the lock downs, and we were excited to revisit our local Korean BBQ place. Once they were ready to seat us, we were informed that we needed to scan a QR code in the lobby to get the menu. The PDF took a very long time to load, and I had the waitress asking us for our drink orders by the time the file finished. Wondering why it took so long, I looked at the URL and saw that it was coming from an S3 bucket in Europe.

I thought it was odd that a restaurant that mostly operates on the west coast of the US was serving their menu from Europe, so I kept the link to take a look at later. This morning I started digging into what I could figure out. The bucket was qrcg-customers. Looking into that name I ultimately found a website for generating QR codes from Bitly. They’re a German company, so they likely just picked an European instance. It’s close at hand for them, and they likely have better compliance with EU laws in a European instance.

What could be done better here?

I don’t think it’s wise to just land customers on a link directly to an object in S3. In my case, I’m having to hit a European data center. I’m on a phone with poor reception in a restaurant thousands of miles away. It would certainly be better to have that data closer to the consumer.

I would tackle this problem by using CloudFront. The PDF file is already serving from S3, it would be relatively simple to set up a CloudFront distribution, and then forward the QR codes to the CDN instead of directly to the bucket. CloudFront also has options to geographically distribute your content across the globe. That way I could be in Souther California getting the PDF from an AWS region on the west cost.

Another alternative would be to replicate S3 data to multiple regions. That would potentially require replicating some of the functionality that CloudFront is providing by using a reverse proxy to determine which regional bucket is closest geographically to the requesting client. It’s more work, and I personally think that if you’re going to add more to your AWS bill, then you should use the right tool: CloudFront.

Finally, you could just use a CDN. Any CDN could do this. If you don’t want to be locked into AWS, you just have to pick an alternative. You could have Akamai set up to cache and globally distribute these static assets that you’re serving behind these QR codes.

Conclusion

With our increased reliance on cellular data, the scarcity of spectrum, and all the other challenges that entails, we need to be more mindful of user’s mobile experience. I often find in my own work, I spend too much time focused on the experience of desktop users. People don’t sit at desktops and use software as much anymore. The world is a more dynamic place, and we need to get data to customers in a timely manner where ever they are.