show hn hit the front page and my 1 vcpu box served 502s for two hours Traffic Spike
Node app and Postgres on the same $6 instance, nginx in front, no cache headers on anything. Sat around 3 req/s normally. Post went up, traffic climbed, and at roughly 40 req/s the box pegged, nginx started returning 502 and it stayed that way until I noticed and rebooted, twice.
So I got four hours of front page attention and served errors for two of them. What is the actual thing to do here — is this a caching problem, a sizing problem, or did I just need to not put the database on the same box?
@layoverlurker · 6d ago · 2 replies
Two hours of 502s during your one moment of attention is the expensive part, not the $6.
Before the next post, load test it and find the breaking number instead of discovering it live.
oha -z 30s -c 100 https://yoursitetakes ten minutes to run and tells you exactly where the cliff is.Then decouple: static marketing page on any CDN host, app behind auth on the box. Once those are separate a traffic spike physically cannot reach your database.
Reply
Report
@boundaries_bo · 5d ago
Worth adding: test with a cold cache and multiple URLs. Half the load tests I see hammer one warm path and produce a number that has nothing to do with a real front page, where people hit /, /pricing, /docs and the og image all in the same second.
Reply
Report