
100k+ page views a month for $5 with a self-hosted static site - nickjj
https://runninginproduction.com/interviews/1-100k-page-views-a-month-for-5-dollars-with-a-self-hosted-static-site
======
AndrewStephens
Static sites served from the filesystem directly through any reasonable
webserver are always going to be quick. 100k hits per month is nothing and a
hackernews spike should not even be noticed unless you are serving up video or
something large.

My site sits on a $5 DO droplet and I have never even come close to hitting
any kind of limit despite the occasional traffic spike.

Dynamic content management systems are a convenience for the
developer/maintainer of the site but push additional requirements onto the
hosting CPU (and the client for javascript heavy sites). The cost of these
requirements is often not clear but usually much larger than you might expect.

~~~
paulddraper
Yep. Wordpress will eat your server if you don't configure page caching.

At $CORP, the web application went down when some heavy Wordpress traffic
slowed down the shared DB :/

~~~
treebornfrog
I'm no programmer but I've used varnish along with nginx, seems to work well.

~~~
paulddraper
You need some sort of cache, whether Wordpress-specific or Varnish or CDN or
something.

------
wesammikhail
I think the most amazing thing that have enabled startups to grow is the
existence of $5 VPS using hosts like Digital Ocean or any of the other ones
out there. However, one of the things that seems to kills performance these
days is the massive amount of code abstraction layers we put in place which
unfortunately increases the overhead by a massive amount.

In our case, I started and successfully exited a crypto trading service
(tradedash.io which was sold to Bittrex.com) that made billions of dollars in
transactions using nothing more than 2x $5 VPS. Our entire tech stack costed
us less than $75 dollars per month. The backend API handled massive amounts of
trading data as you can imagine using those two servers and they never even
got close to being at full utility - even when tens of thousands of orders
were placed and cancelled at the same exact second. We had thousands upon
thousands of users hammering our servers with requests every second of every
day and the dropplets did just fine. At the end of the day, it all comes down
to building out your infrastructure properly.

Clean your code base, use only what you need when you need it and make sure
things are as fast and secure as possible. Dont over-complicate things for
yourself and dont add abstraction layers just for the sake of it. That to me
is the essence of good software and the main benefit of that is less overall
headache as I dont have to go in and engineer a solution every time something
breaks in some random library or abstraction layer. Scale will also be a
fortunate side-effect of that as well.

~~~
apta
Thank you for posting this. Out of curiosity, what was/is your tech stack
like?

~~~
wesammikhail
PHP/MySQL and React/Redux. We also used Electron for the front-end desktop
software. Electron certainly comes with a ton of baggage but upon evaluating
all other options, we decided to go with it because it was the best fit for
our team´s experience.

Other than that, there were actually very few tech pieces involved. I am an
extreme minimalist by nature so I kept things as simple as possible in order
to minimize the surface and complexity of the code base.

Overall, it took us 9 Months in total to build the application from a
prototype phase to a full blown trading system. We did it so fast because we
kept things simple and low in complexity.

------
vinaypai
I don't understand why this is on the front page of Hacker News. 100k monthly
page views is 139 per hour. Even if you assume the peak rate is 10x the
average, that's several seconds per page load. A standard install of WordPress
running off s raspberry pi on your home cable connection could handle that
quite easily.

~~~
rchaud
Since the site in question is a personal blog site that isn't updated daily,
the 100k page views likely aren't uniformly distributed across the entire
month, but occur in a single spike at a certain time, e.g. when a link from it
goes to the HN front page.

In that scenario, the majority of hits will happen in the <24-hour period when
the link is on Page 1.

The rest of the month could see daily traffic in the hundreds, and it might
still amount to 100k+ if added to the traffic obtained during the viral spike
.

------
bArray
I keep telling people 'you probably don't need a massive server if you're just
running static pages', again this seems confirmed (for some use cases).

A few questions:

1\. Do you have any protection against DDoS? I currently implement my own
custom solution, people seem to be transitioning towards Cloudflare but I see
such a move as dangerous. What's your mitigation and/or opinion?

2\. You mention the ease of spinning up a new server - I personally just run a
bash script for this. How do you automate the transference of your URL over to
a new IP?

3\. Have you ever experienced slow down and if so, how did this affect your
site?

4\. What are the most resource intensive aspects of your website? (I.e. What
is using your bandwidth/CPU/RAM?)

~~~
partiallypro
Why is moving to Cloudflare dangerous?

~~~
thaumasiotes
[https://blog.cloudflare.com/why-we-terminated-daily-
stormer/](https://blog.cloudflare.com/why-we-terminated-daily-stormer/)

Moving to cloudflare gives cloudflare veto power over any attempt to access
your site.

~~~
CraftThatBlock
It's pretty simple, don't say Cloudflare are nazis are you will be allowed on
their platform. They have been very vocal about being neutral in almost every
case.

~~~
saagarjha
What if I say something less hateful but still negative about Cloudflare? What
if I run a website like 8chan?

~~~
markdown
Why though? If you don't like a service, move elsewhere. They're not obligated
to serve your site. It's the same as any brick and mortar business. If my
clients attack me, I cut them loose.

------
fimdomeio
This might be impressive for that person's business but I don't think there's
nothing that technically exciting about this. 100k/month is one page view
every 25sec average.

~~~
nickjj
> I don't think there's nothing that technically exciting about this.
> 100k/month is one page view every 25sec average.

The numbers aren't meant to be brag or impress anyone. It's just an example
showing real numbers based on my current site's traffic.

I wrote it because over the past year at least 40 people have asked me how I
host my site and what the process looks like to build it. Now when I get
future emails, tweets or Youtube comments I have a place to link folks instead
of having to wing a half-assed individual response.

Also in a world where everyone thinks you need a multi-galaxy hyper inverted
Kubernetes cluster with DeepMind-level AI to auto-scale to infinity I think
it's a breath of fresh air to know you don't need to do that to host a lot of
different types of content.

~~~
DarthGhandi
> in a world where everyone thinks you need a multi-galaxy hyper inverted
> Kubernetes cluster with DeepMind-level AI to auto-scale to infinity

In a world where you are promoting 100k views for $5 a month perhaps the
people asking you for advice will be given a chance to consider the faster
alternatives for exactly $0

Basic off the shelf webhosting with a half dozen middlemen taking their cut
can handle that perfectly well :/

Sorry to be blunt, but it's entirely true.

~~~
ttttodayjunior
Wouldn't the web hosting cost? And which middlemen were you referring to?

------
FpUser
Static website with 100K page views/month can happily be served without
breaking drop of sweat from a little NUC sitting in one's basement. Not sure
what is so exciting about that particular number.

~~~
semi-extrinsic
I think views per second is a more intuitive metric. 100k views/month is 0.04
views/sec.

~~~
PretzelFisch
If your trying to spec hosting hardware this isn't helpful, since you have to
plan for serving requests at peak time. The real question is what is the max
views/sec the site receives in a given year.

------
hbcondo714
We were looking to rewrite our WordPress site as a static site last year in
the hopes of reducing dev and hosting costs. Our prelim research led us to
Hugo but our discussion [1] with them, including a founder of Netlify, led us
to sticking with WordPress since we have over 2M posts and can get 1,000+ new
posts a day which would lead to a overly-complicated build process and delay
publishing posts.

[1] [https://discourse.gohugo.io/t/transition-2m-posts-from-
wordp...](https://discourse.gohugo.io/t/transition-2m-posts-from-wordpress-to-
hugo/12704)

~~~
manigandham
Static site hosting is usually just S3 + CDN so why wouldn't a CDN in front of
Wordpress caching every page accomplish the same thing for you? No need to
change the editorial process to an entirely new system.

~~~
hbcondo714
Yeah that is what we are doing now

------
apatheticonion
Using S3 and CloudFront to serve static content and I doubt you'd break out of
free tier.

If you need dynamic content served from a CMS, put your CMS's public API
behind cloudfront and bust it when the owner makes changes.

For websites that don't get edited a lot, you can use lambda to store the
website content as a JSON file which sits on S3 (somewhere like
/content.json).

If you have multiple editors, use Dynamo or Firebase as the content store
(again, behind cloudfront).

With every one of these options, the most expensive part would be the domain
name.

~~~
_salmon
Yep, I'm using Hugo to generate a site hosted on S3/CloudFront. 8k hits this
month and my bill so far is $0.04

------
web007
This site would be roughly $free to run through CloudFront on AWS, which would
scale more-or-less infinitely at a sublinear cost.

Their free tier covers 50GB of transfer and 2mm requests. If you need an extra
50GB as indicated elsewhere in the thread it would cost about $4.25 a month,
less if it's not the full 50.

I'm looking to move off of a cheap shared hosting provider and on to AWS for
my ten-accidental-hits-a-month personal (static) sites, it doesn't make sense
to even consider a webserver for a solved problem like this.

~~~
nickjj
The free tier for CloudFront only lasts for 12 months. After that you're on
the regular plan.

~~~
JCharante
*AWS

------
mcone
Just out of curiosity, why aren't you using a CDN like Cloudflare?

~~~
reustle
[http://techrights.org/2019/02/17/the-cloudflare-
trap/](http://techrights.org/2019/02/17/the-cloudflare-trap/)

Some interesting reading on it

------
dsiegel2275
I ran a small single page JavaScript app that at its peak had 10K visitors per
day. I served all the static assets directly from a public S3 bucket fronted
by Cloudflare (for caching, domain name resolution).

For my use case it was the simplest (and cheapest) thing that could possibly
work.

------
fwxwi
If it's just nginx serving files you can do this with a 386. I mean seriously
what's so special about this? Maybe I'm missing something. Pretty sure nginx
can serve thousands of static files with gzip+ssl per second using the
crappiest ARM VPS available. Stick that in Online.net or OVH and you will pay
no bandwidth fees.

Of course if your baseline is a wordpress site where every page weighs 3 MB
and takes 2 seconds to generate when there's no server load, then this might
seem like black magic to you

~~~
jonny383
You do realise you're reading hackernews, right? Where the majority of this
generation likely grew into the industries using AWS / Heroku / "your other
managed server as a service tm"

------
barbellguy97
Can't you run this for free on Netlify?

~~~
nickjj
I'm pretty close to reaching their free tier's cap on outgoing bandwidth. They
only give you 100 GB.

To buy another 100 GB I would have to pay $20 per month (4x as expensive).

Also I don't feel comfortable basing my entire business on Netlify. My blog
and course landing pages are how I earn a living. It's the same reason why I
don't use GitHub pages. I just don't like the idea of having to adhere to
their TOS (even if I'm not doing anything wrong) and also be limited to their
free tier's traffic constraints.

I'm sure they are a good company and I wish nothing but the best for them but
I just don't see them as a good fit for me given the above.

~~~
JoshMcguigan
How do you view your Netlify usage while on the free tier? Your comment made
me curious about my own usage, but I can't see a way to determine my current
usage through the Netlify website.

~~~
nickjj
> How do you view your Netlify usage while on the free tier?

I am not sure. I never used their service. I got my usage numbers from
DigitalOcean's dashboard.

But I recently looked at Netlify to host another static site and they mention
that 100 GB limit on their pricing page.

------
qatanah
100000 / 30 / 24 / 60 / 60 = .03 views per sec.

Nothing surprising here.

But a great blog overall!

~~~
LeonM
Exactly my thoughts.

Even a raspberry Pi can serve 100k page views in a matter of minutes
(seconds?). But in a world of serverless-cloud-bigdata developers seem to have
forgotten just how powerful modern computers are, and how much we have already
been doing for decades with less powerful hardware.

Just to give you an idea: in 1997 Rob Maldo grew Slashdot to 100k pageviews a
_day_ on a single server [0] [1].

[0]
[https://news.slashdot.org/story/17/10/03/2330258/slashdots-2...](https://news.slashdot.org/story/17/10/03/2330258/slashdots-20th-
anniversary-history-of-slashdot) [1]
[https://en.wikipedia.org/wiki/Slashdot](https://en.wikipedia.org/wiki/Slashdot)

------
topicseed
I run a WP website with 500k monthly page views (~800 blog posts). How would
you go on implementing a static site (Gatsby would be my choice) knowing that
there are WooCommerce and Sensei (Courses) installed? WP-REST?

------
modeless
Cloudflare + App Engine is working well for my mostly static site. The
combination is completely free for any amount of traffic, and scales
practically to infinity with literally zero effort.

------
tuananh
when i see a statistic number in per month unit, it's probably not very
impressive when using a smaller unit like per hour / per second.

i've used a $20 DigitalOcean in the past that used to serve 5 millions
pageviews per month. but that number is not very impressive at all.

at peak, there were at most 2,500 people online (number via Google Analytics)
and that's not a lot.

I know I could have done better with other solutions but most of the editors
are familiar with WordPress so I had to keep using it and optimize the heck
out of it.

------
Havoc
That's pretty cool.

I've been toying with loadtesting a WP site. Out of the box it can't handle
much even with a beefy server.

Currently looking at Wagtail as a hopeful happy medium between WP and static

------
mikefallen
Thought this was a great article don't know why so many negative comments

------
xwdv
Why not just serve direct out of S3?

~~~
tambre
S3 website hosting lacks official IPv6 support, HTTP/2, TLS 1.3.

~~~
xwdv
What does that matter for a static blog site?

~~~
tambre
Offers subpar speed and accessibility. Of course all the problems could be
solved by simply using a CDN like Cloudflare.

~~~
xwdv
Why the hell wouldn’t you use a CDN? Throwing up files on S3 and then putting
your site behind a CDN has to be way cheaper and more available than serving
it out of some EC2 server running Nginx 24/7.

