News for hackers. Stuff that matters.
Re:Mummy – web server written in Nim that returns to the anc... by daper on Saturday December 31, 2022 @02:26PM (#34199781)
Varnish (HTTP caching only) also uses one thread per client. I believe worker threads are used to handle reuqests while a dedicated thread handles all the idle connections between requests using epoll(). Also per-threads stack size is lowered so thousands of threads don't occupy massive amount of memory.

Single threaded HTTP servers have their own issues. If the bottleneck is the storage then lack of async open()/stat() and some other calls is problematic. We feel that serving hundreds of millions of files (long tail content) from slow storage using nginx. For that reason you can configure nginx to spawn multiple processes.

Re:Mummy – web server written in Nim that returns to the anc... by rkeene2 on Saturday December 31, 2022 @02:42PM (#34199944)
I wrote an extremely fast static HTTP server for this purpose [0].

[0] https://filed.rkeene.org/

Re:Mummy – web server written in Nim that returns to the anc... by metadat on Saturday December 31, 2022 @05:32PM (#34201425)
Off-topic: What happened to rkeene1?

btw I really appreciate the design of you site, it's simple, clean , and beautiful. Timeless.

Re:Mummy – web server written in Nim that returns to the anc... by bch on Sunday January 01, 2023 @04:13AM (#34204880)
It looks like @rkeene2 styled it, but that’s a site served up by fossil[0].

[0] https://www2.fossil-scm.org/home/doc/trunk/www/index.wiki

Re:Mummy – web server written in Nim that returns to the anc... by habibur on Saturday December 31, 2022 @04:01PM (#34200702)
Thought nginx epolls file i/o too along side socket i/o. Or did you find that the first call to open() or stat() stalls, while read/write after that continues normally?
Re:Mummy – web server written in Nim that returns to the anc... by Matthias247 on Sunday January 01, 2023 @04:25AM (#34204929)
File IO isn’t epoll-able. The operations are always blocking.

Those could however be offloaded onto a threadpool, to avoid the blocking to affect any other requests that are processed by the same Nginx worker. Nginx however only partially does that - whole file read and write operations are offloaded a whole bunch of other IO (stat, open, close) are executed on the main thread. I guess due to implementation challenges - one can’t just make one operation async but also needs to make each operation that utilizes those methods async.

Re:Mummy – web server written in Nim that returns to the anc... by habibur on Sunday January 01, 2023 @06:22AM (#34205458)
Searched nginx source. Seems like it's using aio_read() aio_write()

./src/os/unix/ngx_file_aio_read.c

API's doc https://man7.org/linux/man-pages/man3/aio_read.3.html

Even though the source is there don't mean it's compiled or used though. Might or might not be. No idea about the details.