5 ms·
You should've invested in CloudFront first because your site isn't loading.
by sbf501 4y ago
You should've invested in CloudFront first because your site isn't loading.
- dsmmcken 4y agoI know. I wasn't actually expecting to hit front-page. Trying to reinforce it best I can.
- brundolf 4y agoFwiw, in my experience you don't actually need a CDN just to survive HN. It may be enough to just make sure you're not hitting a DB on every request; ideally you'd be caching the HTML output wholesale (via static site generator or otherwise) For reference: with cached HTML, my single Node.js process running on Heroku's cheapest tier has weathered the front page multiple times without breaking a sweat
- knicholes 4y agoRight, like something like Varnish.
- brundolf 4y agoHadn't heard of Varnish, but yeah, it looks like a good solution the OP could probably layer over their current setup without too much trouble
- wyager 4y agoI switched backends a bunch of times because everything I tried (Go stdlib HTTP, Tornado, etc.) kept getting taken out whenever I would hit the front page, either due to CPU overload or some sort of resource leak. I ended up using Warp+Wai+Servant (https://github.com/yesodweb/wai https://github.com/yesodweb/wai) and it has been smooth sailing since then off my $3/mo VPS. It can take thousands of req/sec without flinching (which is higher than what you see from top of HN - that maxes out at a few hundred req/s).
- layer8 4y agoDid you use some software/service for load-testing the alternatives?
- wyager 4y agoYes, I first tested locally with httperf and some other tools. I took it as a good sign when the load testing tools crashed before my server did. Then, I found a few services by searching for something like "website load test" and using their free tier (which would typically generate something like a few hundred req/sec - sufficient to simulate HN).
- mahathu 4y agoWhat VPS are you using and can you recommend it?
- wyager 4y agoVultr. They have been totally solid for me. Nothing fancy - just a reliable cloud VM. Have had no reason to look for alternatives for web hosting.
- pyrolistical 4y agoRight. So a CDN?
- brundolf 4y agoA CDN is its own thing- it's distributed across a provider; it can't just be served off a simple box. It requires having or gaining familiarity with a specific provider, as well as other constraints like you have to statically export to the file system (can't just cache responses in memory), and you can't have any dynamic content without standing up a separate server, etc Makes sense for a lot of things, but it comes with downsides, especially for hobbyists! I've found I prefer sticking with a simple server for my website, and OP might find it's easier to do that too
- jedberg 4y agoThat's not at all true. A CDN is a content delivery network. There is nothing that says it isn't a network of a single host on the same machine as the original content. It's just a cache that returns content faster than the original content.
- kortex 4y agoNope, that's just a proxy/cache. > A content delivery network, or content distribution network, is a geographically distributed network of proxy servers and their data centers. The goal is to provide high availability and performance by distributing the service spatially relative to end users. Emphasis mine. CDN implies some sort of edge-hosting topology (or at least more-proximal than the main servers).
- jedberg 4y agoNot sure why you think CDN implies geographically distributed edge hosting. Are you getting that from Cloudflare's marketing? A company that sells a geographically distributed network?
- TremendousJudge 4y agoAt that point, why not just have a static blog hosted on an AWS bucket?
- brundolf 4y agoFor me: it's less to manage, it's less to learn (AWS is a nightmare from my perspective), and I enjoy other benefits like the fact that one codebase can generate and then serve up the site, and the fact that it's vendor-agnostic (just clone/npm install/run). Also allows easy customization of headers and redirects, allows for the odd dynamic route, and makes local dev/previewing super simple OP may or may not feel the same! Just wanted to communicate that a simple server can definitely do the job
- dsmmcken 4y agoFor reference, it's a fully static site on a low-end shared host. The post had quite a few images, which were pngs from DALL-E, but I've just now recompressed as smaller jpg.
- mym1990 4y agoJust curious, is there any general number range for how much traffic a front page post might get? Less than 10k, 10-100,000, 100,000+, etc
- dsmmcken 4y agoI can tell you it's more than a $5 dreamhost box can handle right now.
- deleted 4y ago[deleted]
- wyager 4y agoMy $3/mo vultr box can handle HN loads easily when using a fast and well-designed (namely resource-leak-free) backend (I've settled on https://github.com/yesodweb/wai https://github.com/yesodweb/wai based apps - the only thing that has worked well for me so far).
- ezekg 4y agoI've gotten on the front page more than a few times. In my experience, it usually peaks around 1.5k concurrents for a blog post. Peak was 50k total visits over a couple days, but has been much less too. Depends on the content and how interesting it is to the wider HN audience.
- sbierwagen 4y agoI front paged a couple times back in the day. In the neighborhood of thousands of pageloads and hundreds of concurrent users. Totally trivial for static HTML, but most people get into trouble with hand-rolled or poorly tuned blog frameworks that make multiple database calls on every visitor.
- Swizec 4y agoI once frontpaged with a funny article that readers also shared with others. Back when people still did that instead of taking a screenshot. 1,000,000 uniques over 3 days in ~2011. I have been trying to re-create that high ever since, lol. Going viral is one hell of a drug.
- lmarcos 4y agoWould nginx (caching everything) work on a $5/month VPS?
- wyager 4y agoShould work fine. I personally avoided using a reverse proxy like nginx or apache because they tend to have a ton of vulnerabilities (check out the CVE database results for "nginx"), making them a security management headache.
- vient 4y agoAny serious vulnerability in NGINX will be big news since it is so widespread. CVE database shows some entries by searching for "nginx" but I looked at all 2022 entries and the only ones affecting NGINX itself are in NJX plugin so actually not affecting NGINX core functionality. https://nginx.org/en/security_advisories.html https://nginx.org/en/security_advisories.html shows one "medium severity" vulnerability in the last 4 years.
- wyager 4y agoHuh, guess I haven't really checked on this since mid-early 2010s. Was a lot worse back then.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]