Lurker News

Comments (57) 16 threads

Earlier comments
antisemiotic1 reply#
Heh, you beat me to publishing my own simple HTTP server. Though the one I'm working on is even more dumbed down, only supporting GET to serve prepared HTTP messages from a hash table (this requires a creative interpretation of RFC 7230 to avoid including the Date header which would have to be updated each time).

I very much approve of this tutorial, I remember when long time ago I tried to understand how a web server works, and learned that I need to install Apache, then put stuff in CGI directory, or maybe just use a framework and not have a separate server at all... It was quite confusing for me back then. But the core functionality of a HTTP server is just listen on a port, accept connections, read text, write text.
For anyone interested, I also recommend to read "Unix Network Programming" books; the first part is about actual network programming, the second about inter-process communication on a single computer. For example, the old art of using Unix-domain sockets for TCP or UDP on a single computer (harder to hack by shady javascript in your browser!) seems unjustly forgotten.

bgilroy261 reply#
For a more introductory audience, Ruslan Spivak's Let's Build a Web Server series of blog posts is a great hands-on learning resource

https://ruslanspivak.com/lsbaws-part1/

shuss#
Thanks for sharing this. This is such a great resource.
cadamangue1 reply#
Great article, explains things better than most O'Reilly books.
shuss#
LOL! Thanks :)
megous1 reply#
It would be nice to also compare memory use, which will vary between implementations.
dominicl1 reply#
Awesome comparison, super curious how this would scale out on the current generation of big CPU machines. E.g. Epyc with 64 cores, would threads still perform that well?
shuss2 replies#
Would be lovely to get my hands on such metal :) I wonder how Linux thread scheduling scales on multi-CPU machines. To keep things simple, I specifically chose to go with a single-core machine to benchmark all architectures.
shuss#
Thanks for sharing!
jrockway1 reply#
Where did you find a single-core machine? Even a raspberry pi is quad core these days.
BanazirGalbasi#
He mentions in the article that he's testing with DigitalOcean VPSs, so he's using VMs with only a single core allocated.

Load more comments