Earlier quoted context omitted.
1000 lines are easier to secure than 5 million lines
“You can write software that has no obvious bugs or you can write software that obviously has no bugs.” I think that was ewd?
Show HN: Hosting my website using my C web server
41–50 of 160 posts
Re: Show HN: Hosting my website using my C web server
#42Re: Show HN: Hosting my website using my C web server
#43Finally a website that doesn't crash when it shows up on the front page
Any site with a CDN in front of it can do that. Don’t get me wrong this is an awesome project but if you really care about this kind of thing in a production scenario and you’re serving mostly static content… just use a CDN. It’ll pretty much always outperform just about anything you write. It’s just boring.
You are vastly overestimating HN front page traffic. Any reasonable system on any reasonable machine with any reasonable link can do this. And I really do mean reasonable: I've served front-page traffic from a dedicated server in a DC, and from a small NUC in a closet at home, and both handled it completely fine.
Re: Show HN: Hosting my website using my C web server
#44> Show HN: Hosting my website using my own C web server "But if you actually do this, WAT" – https://www.destroyallsoftware.com/talks/wat As with much of HN, this is fun, a good thing to learn while making and reading about... but it likely needs the caveat that doing this is production isn't a good idea (although in this case the author does not appear to encourage production usage).
It’s a great way to get hacked
Re: Show HN: Hosting my website using my C web server
#45Finally a website that doesn't crash when it shows up on the front page
Any site with a CDN in front of it can do that. Don’t get me wrong this is an awesome project but if you really care about this kind of thing in a production scenario and you’re serving mostly static content… just use a CDN. It’ll pretty much always outperform just about anything you write. It’s just boring.
Honestly, HN front page traffic isn’t much. For most, it probably peaks at about one page load¹ per second², and if your web server software can’t cope with that, it’s bad.
Even if your site uses PHP and MySQL and queries the database to handle every request, hopefully static resources bypass all that and are served straight from disk. CPU and memory usage will be negligible, and a 100Mbps uplink will handle it all easily. So then, hopefully you’re only left with one request that’s actually doing database work, and if it can’t answer in one whole, entire second, it’s bad.
(I’m talking about general web pages here, not web apps, which have a somewhat different balance; but still for most things HN traffic shouldn’t cause a sweat, even if you’ve completely ignored caching.)
Seriously, a not-too-awful WordPress installation on a Raspberry Pi could probably cope with HN traffic.
—⁂—
¹ Note this metric: page loads, not requests. Requests per second will scale with first-party requests per page.
² From a quick search, two sources from this year: https://marcotm.com/articles/stats-of-being-on-the-hacker-ne..., https://harrisonbroadbent.com/blog/hacker-news-traffic-spike.... Both use JS tracking, but even doubling the number to generously account for we sensible people who use content blockers has the hourly average under one load per second.
Re: Show HN: Hosting my website using my C web server
#46Re: Show HN: Hosting my website using my C web server
#47Earlier quoted context omitted.
Any site with a CDN in front of it can do that. Don’t get me wrong this is an awesome project but if you really care about this kind of thing in a production scenario and you’re serving mostly static content… just use a CDN. It’ll pretty much always outperform just about anything you write. It’s just boring.
Even caching is normally unnecessary. Honestly, HN front page traffic isn’t much. For most, it probably peaks at about one page load¹ per second², and if your web server software can’t cope with that, it’s bad . Even if your site uses PHP and MySQL and queries the database to handle every request, hopefully static resources bypass all that and are served straight from disk. CPU and memory usage will be negligible, an…
Well then sites on average are sadly "bad" by your standards. Lots of sites that get on the front page of HN go down.
Re: Show HN: Hosting my website using my C web server
#48One question: you say that "Transfer-Encoding: Chunked responds with 411 Length Required, prompting the client to resend with Content-Length". Is there a reason for doing this (security perhaps), or is it just a choice?
Re: Show HN: Hosting my website using my C web server
#49Earlier quoted context omitted.
Even caching is normally unnecessary. Honestly, HN front page traffic isn’t much. For most, it probably peaks at about one page load¹ per second², and if your web server software can’t cope with that, it’s bad . Even if your site uses PHP and MySQL and queries the database to handle every request, hopefully static resources bypass all that and are served straight from disk. CPU and memory usage will be negligible, an…
> and if your web server software can’t cope with that, it’s bad. Well then sites on average are sadly "bad" by your standards. Lots of sites that get on the front page of HN go down.
Re: Show HN: Hosting my website using my C web server
#50Kudos for your project -- it is great fun and a learning experience to implement your own HTTP server in a low(er)-level language. One question: you say that "Transfer-Encoding: Chunked responds with 411 Length Required, prompting the client to resend with Content-Length". Is there a reason for doing this (security perhaps), or is it just a choice?