

Ask HN: could an EC2 microinstance handle being on TechCrunch or front page HN? - hoodoof

Say you managed to get TechCrunch to cover your site, or if your site got to the front page of HN, and you had a static HTML page as your index.html with all the images coming from a CDN, would an EC2 micro instance running Nginx be able to handle the load?
======
bhauer
I'm going to go against the grain and say yes [1].

Static HTML hosted by nginx? How many hits do you honestly think being on
TechCrunch would get you? 100,000? 200,000? 500,000? And over how much time?
500,000 requests in total over the course of a day?

nginx or any high-performance platform is designed to deliver hundreds of
thousands of static responses in a second on high-performance hardware. Even a
micro instance, for all its infinitesimally tiny CPU power, can deliver a
small fraction of that. Let's say for the sake of argument a micro instance
provides 0.5% the performance of an i7 2600K.

Knowing that an i7 2600K can easily saturate a gigabit Ethernet connection
with over 200,000 small responses per second [2], and knowing that it's even
easier to do so with large responses, we just have to be comfortable that our
micro instance can handle your 500,000 requests per day. 0.5% of 200,000 rps
is 1,000 rps. With 1,000 rps, we could fulfill our entire day's worth of
500,000 requests in 500 seconds.

Being #1 on the HN home page will yield sustained traffic in the realm of 10
to 30 requests per second. I think there's a lot of confusion about the load
generated by being on the HN home page because we all have seen sites taken
off-line by upvotes. That is more of an indication of architectural failures
in web applications than a failure of the hardware.

[1] An important caveat being I understand that Amazon throttles active micro
instances using some arcane algorithm that I've never actually taken the time
to understand. It is certainly _possible_ that they would throttle its
performance so much that you could not handle a few dozen requests per second.
But that too seems implausible to me.

[2]
[http://www.techempower.com/benchmarks/](http://www.techempower.com/benchmarks/)

Additional caveat: you need to not make silly mistakes in your nginx
configuration.

~~~
hoodoof
I tend to agree with you (not on the basis of facts, but on hunch).

One thing about your calculations I would challenge is that 500,000 requests
per day is 1,000 rps. If a site gets 500,000 requests because it was on
TechCrunch for example, then the traffic flow is likely to be lumpy rather
than smooth, with an initial very high peak requests per second declining over
time.

The point being that you can't plan for traffic by dividing requests per day
into requests per second. You need to plan for peak requests in any given
second in that day, which is some number up to the total, hard to work out
what.

~~~
bhauer
Yes, real-world traffic will definitely vary over time.

1,000 rps is _significantly_ beyond the average rps needed for 500,000
requests per day (which works out to an average/sustained ~6 rps). I consider
the capacity to handle 1,000 rps well beyond the realm of handling the
unpredictable burstiness of a 6 rps sustained load.

But just to contribute some anecdotal evidence: I've never observed greater
than ~50 rps from the HN #1 position. Real world traffic is not smooth, but
it's also not bursty to quite the degree that would be necessary to cause the
server to wince.

All of this remains predicated on Amazon not throttling the CPU capacity to
true zero or something approximating true zero.

------
mqzaidi
Not worth the risk. While the micro instances can handle the load and have
good burst performance, they aren't good if the load is sustained. So if you
get a sudden burst, and load average jumps, expect EC2 to penalize you.

See steal time and stolen CPU - [http://www.newvem.com/whats-cpu-steal-
time](http://www.newvem.com/whats-cpu-steal-time).

I have seen a micro instance become unaccessible to even ssh after a prolonged
activity.

------
nhoss2
I had a front page item about a year ago. The article ended up getting like
300 points so it was on the front page for around 12 hours. All the content
was served by nginx on a micro EC2 instance, nothing was even put on a CDN.
But still, it worked flawlessly.

~~~
hoodoof
Interesting. How do you know it worked flawlessly?

------
Wouter33
No, it would not handle the load. But you can use your AWS S3 bucket as a host
for your index.html file. In route 53 you can easily point the index of the
domain to your S3 bucket. This way you have a huge load capacity for the
lowest prices.

~~~
hoodoof
If you host from S3 does that mean that we cannot have things like forms for
example - because all requests to the domain are going to S3?

~~~
czbond
You can have forms, but they need to be jquery submission from the S3 static
HTML to an external mongo sitting separately on your EC2 micro in the domain
(or by IP address). Since you would receive few submissions likely - it would
be fine I would think.

------
C1D
No. Many sites paying for hosting serving static pages go down by being on the
front of HN so I doubt a free ec2 instance could out preform a paid one.

It's like asking if a gameboy can play battlefield 3.

~~~
hoodoof
Micro instances aren't free. Unless you are on the AWS free tier. But of
themselves, they are not free.

------
czbond
As Wouter33 mentioned, put the HTML, CSS, and images in S3 (or CloudFront). I
did this for a Top 3 U.S. music superstar client when they launched new stuff,
and it held up fine.

~~~
hoodoof
Do you mean a micro instance held up fine?

~~~
czbond
I got 40k unique visits hours 1-2, and 200k unique visitors total over the
course of a week (this traffic is probably much higher than a TCrunch article
would be). Only static html, no servers at all - everything held together very
well (i was monitoring twitter in case...bc if it went wrong it would be not
good for me).

~~~
hoodoof
Hello czbond. Did you get onto the front page of HN? What was the post that
got you there?

~~~
czbond
No - it was an singer who ran Billboard magazine ads, released a song, and was
on the U.S. Grammys all in the same week.

------
munimkazia
If you have a static html page, do a silent redirect to the CDN which will
also host the html page apart from the resources. That will work nicely.

------
ben_pr
No. The EC2 micro instances are not stable or reliable. I had to move to a
small instance just because the micro instances kept going offline.

~~~
hoodoof
I've used micro instances extensively for a long time in locations all around
the world and never had one go offline.

~~~
czbond
Hoodoof, I agree with you, they're very stable. The cpu and network traffic
can hiccup occasionally - and the cpu throttles higher than a small instance.

