

Ask HN: How do you prepare a site to handle being on HN's frontpage? - jeffreyrogers

I&#x27;m sure we&#x27;re all familiar with sites making the front page of HN and promptly going down under the traffic load.<p>I&#x27;m wondering if anyone can point myself and others to a list of best practices to prevent such a thing from happening.
======
applecore
The easiest way is to host a static site.

They're trivial to set up and they'll stand up to just about any amount of web
traffic, even on a tiny VPS.

Look into a static site generator like Jekyll[1] or Pelican[2] to get started.

[1]: [http://jekyllrb.com/](http://jekyllrb.com/)

[2]: [http://blog.getpelican.com/](http://blog.getpelican.com/)

~~~
stevekemp
Even with static sites tuning is a must though:

[http://tweaked.io/](http://tweaked.io/)

------
lutusp
> I'm wondering if anyone can point myself and others to a list of best
> practices to prevent such a thing from happening.

Some obvious remedies:

1\. Don't post anything interesting to HN.

2\. Buy a service that can handle ten times a normal access load, and arrange
for incremental capacity increases as the need arises.

I've been in the position of having my server overwhelmed on a number of
occasions because of "successful" posts to various social media, and it turned
out that no reasonable advance precautions would have made much difference.
It's a matter of minimizing the server downtime, not of eliminating it
entirely.

------
anthony_franco
First use a tool like ab to see what your site can currently handle.

From that monitor the requests to see what's taking up most of the time
(NewRelic is one tool that can help with that, or just analyzing your log
files ia fine too). For me, I've noticed caching database queries or just
caching entire pages helps the most.

Then rerun the ab tool to see how much you've improved. Repeat as necessary.

------
davidgerard
For WordPress, just WP Super Cache is well up to the task.

[https://wordpress.org/plugins/wp-super-
cache/](https://wordpress.org/plugins/wp-super-cache/)

Basic mod_rewrite caching will stand up to HN; for Reddit, you'll need to go
to direct-access caching. Source: accidentally writing something popular a
couple of times.

------
anderspetersson
One thing I did after being smashed with visitors from Facebook was building a
feature switch were I can turn off the most intense functions of the site. It
have worked well.

Loadtesting helps to determinate this features is and how your site will react
under load.

Caching is probably the first step if you're not already doing that.

------
adityar
Static site+CloudFlare

