Live data from Hacker News

Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

medium.com

41–50 of 64 posts

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#41

I have set up some sites the same way, the only ugly part for me was that I wanted to use the features of S3 web hosting interface, but restrict all traffic to come through CloudFront. This blog post (not mine) describes the problem and the approach: https://abridge2devnull.com/posts/2018/01/restricting-access...

there's actually a way to do this with OAI, you just have to configure the html5 routing stuff using CloudFront distribution rules instead of configuring the S3 bucket as a static website. As a nice side effect, you can also enforce httpshttpshttps communication all the way through the S3Cloudfrontworld chain, which isn't possible to force when the S3 bucket is configured for static site hosting.

I have about 75% of a blog post about how to do this, it's not terribly complicated. This comment just gave me the motivation to finish it, I'll post it on HN when it's ready.

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#42
post #7
post #4

Cost-comparisons aside, the massive speed improvement makes me think he didn't have caching configured correctly with Cloudflare and his PHP backend (thus defeating the entire point of the CDN aspect). I'm guessing a couple of Cache-Control: headers would have provided similar latency improvements.

Comparisons were done with CloudFlare on static site, it's been a very long time since the site was based on Laravel and PHP. I had set Browser Cache Expiration to 1 month within my CloudFlare settings as was luckily screenshotted within a previous article: https://medium.com/@elliot_f/my-journey-into-web-speed-optim... I'm fairly sure that I had some speed optimizations set within my Nginx server block. Unfortunatel…

That setting is what Cloudflare passes on down to your visitors, not how long it caches itself.

I don't actually know cloudflare personally, but assuming they're following the spec, you need to set "Cache-Control: max-age=300" or "Cache-Control: s-maxage=300" to tell cloudflare to cache a given response for 5 minutes.

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#43
post #7
post #4

Cost-comparisons aside, the massive speed improvement makes me think he didn't have caching configured correctly with Cloudflare and his PHP backend (thus defeating the entire point of the CDN aspect). I'm guessing a couple of Cache-Control: headers would have provided similar latency improvements.

Comparisons were done with CloudFlare on static site, it's been a very long time since the site was based on Laravel and PHP. I had set Browser Cache Expiration to 1 month within my CloudFlare settings as was luckily screenshotted within a previous article: https://medium.com/@elliot_f/my-journey-into-web-speed-optim... I'm fairly sure that I had some speed optimizations set within my Nginx server block. Unfortunatel…

There is a substantial performance difference in SSL handshake speed and site performance if you have a central server, vs multi-edge storage before you get to Cloudflare. The closer your edges are to Cloudflare's edges when the handshake happens the faster things go. The handshake delay is particularly slow internationally with Heroku running under CF, since you can't predict what heroku IP you are fetching from, unless you fix to one point and then latencies are still long at far away locations.

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#44
AWS and the like make a killing from the basic fact that most web devs don't know anything about the real costs of bandwidth (a blind spot, if you will).

HE.net is currently advertising 10gig ethernet for $1300/mo. Obviously there are various scaling issues associated with this but the basic premise still holds - AWS and other cloud services need major pressure to push their bandwidth prices down.

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#45

AWS and the like make a killing from the basic fact that most web devs don't know anything about the real costs of bandwidth (a blind spot, if you will). HE.net is currently advertising 10gig ethernet for $1300/mo. Obviously there are various scaling issues associated with this but the basic premise still holds - AWS and other cloud services need major pressure to push their bandwidth prices down.

This is less about cost of bandwidth and more costs of having edge POPs around the world.

With cloudfront (or any other edge cache system), you get TCP termination closer to end-users so the site loads faster, particularly if you have users around the world. Dropbox case study: https://blogs.dropbox.com/tech/2017/06/evolution-of-dropboxs...

Edge cache bandwidth costs quite a bit more than the not quite bottom of barrel IP transit that HE.net is selling.

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#46
post #19
post #15

Earlier quoted context omitted.

My linode hasn't been updated for years, still runs nginx just fine. port knocking means little risks of intrusion, as ssh is on a non standard port too. My deployment is shell scripts launched by systemd timers Instead of downvoting, can someone please explain why this setup that is stable is not up to whatever standards?

Most likely your "hasn't been updated for years". Given all the security vulnerabilities that have been disclosed, including things like Heartbleed, I hope you meant your "setup hasn't been changed in years".

No, I run nothing like apt update. Why would I fix something not broken? And no, I do not run ssl. I like to limit the number of moving parts.

Anyway, if someone can manage to access my servers with only nginx serving static files, they deserve to 0wn it :-)

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#47
post #15

Earlier quoted context omitted.

My linode hasn't been updated for years, still runs nginx just fine. port knocking means little risks of intrusion, as ssh is on a non standard port too. My deployment is shell scripts launched by systemd timers Instead of downvoting, can someone please explain why this setup that is stable is not up to whatever standards?

You have a single point of failure and a linux box (and CMS?) that needs to be constantly patched - how is that in any way comparable to the simplicity and scalability of dropping files onto an S3 bucket?

No cms. Nginx serving static files. Not patched or upgraded for years. Still running fine.

Doing anything else than putting cloudflare in front of my nginx is needlessly overhead- because cloudflare scales quite well!

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#48

Earlier quoted context omitted.

> This is probably an exceptional rate of change for the _vast_ majority of static sites. I also doubt that many static sites have much "overhead" related to maintaining nginx config files and Let's Encrypt certificates.

Sure, but then there's the whole overhead of maintaining a server.

Maintaining a server is not complicated nowadays, with ansible. I have a few dozens, some of them don't need any admin for years (like linode), the others have debian testing and ansible to deploy matching configurations and keep up with the updates

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#49
post #11

Earlier quoted context omitted.

Link for Spaces? Couldn't search it since was fairly generic term.

Sorry. Spaces = Digital Ocean's Spaces product. $5/month. Park a CDN in front of it with Edge rules and you get a similar setup.

Spaces will get a native CDN this year if DOS roadmap is to be believed.

Re: Scaling Your Static Site to a Global Market for a Fraction of the Cost on AWS

#50

Earlier quoted context omitted.

Nowadays, if you really don't need a server, then don't spin up one. In this case, the author does not need a server. If you think you might need to do some backend processing, see if you can use 'serverless' functions and offload the admin work to someone else. If that doesn't suffice, maybe something like App Engine. Still not enough? Ok, so maybe a AWS batch job (or equivalent). Does it have to run all the time? T…

You can just use Cloudflare Workers to do whatever serverless things you need.

I think it's customary to declare any product affiliations on HN if your post is promoting a product.
Post reply on HN