This Site Can Handle 450 Requests/Sec

Ok, ok, ok - that's only exciting under certain circumstances. Yes, this is just a static site generated by Jekyll. There is nothing transactional. There is no database. But, there is an important fact, and that fact is this site costs about $0.15/month to run no matter how much traffic might slam it.

To give you some overview, here's what's in play:

  1. Jekyll for writing content and generating the static site output.
  2. AWS S3 for hosting the content.
  3. Cloudflare for CDN, DDoS protection, etc.

In this configuration I did a couple of tests. One with a very cool tool called Goad that does load testing with a Go application and AWS Lambda. Here were the results:

Region: us-east-1
   TotReqs   TotBytes    AvgTime   AvgReq/s  AvgKbps/s
     44902     169 MB     5.197s     489.79    1872.41
   Slowest    Fastest   Timeouts  TotErrors
   19.898s     1.149s       1289       1684
Region: us-west-2
   TotReqs   TotBytes    AvgTime   AvgReq/s  AvgKbps/s
     45943     172 MB     5.175s     412.00    1576.12
   Slowest    Fastest   Timeouts  TotErrors
   24.881s     0.875s       1551       1946

Overall

   TotReqs   TotBytes    AvgTime   AvgReq/s  AvgKbps/s
     90845     342 MB     5.186s     450.45    1722.57
   Slowest    Fastest   Timeouts  TotErrors
   24.881s     0.875s       2840       3630
HTTPStatus   Requests
       200      87215

Sure, there are a few timeouts and other errors, some of which are due to AWS Lambda or SQS (both used by Goad), others likely by Cloudflare getting pretty quickly bombarded. But those 90k requests happened within the span of about a minute and a half. Your $5 budget host would have come crashing down hard under that number of requests. A 4% error rate with a sudden surge of nearly 100k visitors in just over a minute is quite respectable.

If you've got a site that can serve its purpose as a generated static site, it's very impressive how easy it now is to scale it with modern tools. Even 10 years ago you'd have had a very hard time doing this before you'd have bandwidth issues, even if you had your whole site in memory on your host server. I'mon Cloudflare free and the S3 cost to host this static site comprises the ~$0.50 a month.

While some of the uses of this type of setup might be esoteric, one thing to keep in mind is that if you don't have a setup like this you're vulnerable to DDoSing both financially and technically - meaning you're going to pay for the bandwidth and probably going down hard. And the bandwidth saving is no joke. Here's what Cloudflare's analytics showed after this test:

alt text

alt text

But, I think this also does a good job of providing some ideas of how to scale something even more complex. With effective caching in play, you could probably use a similar pattern to provide much more dynamic content. Consider an S3 hosted site using JavaScript to interact with an AWS API Gateway, Lambda and DynamoDB as your backend. Perhaps I'll try that next...