> […] thus letting the OS handle the dynamic allocation needed for each connection.
This is what PHK did when designing Varnish (IIRC): instead of dealing with lots of files on its own (like Squid), just create some files and do a malloc() on them and let the OS do the work:
I think the original point still stands. When the application tries to handle memory pressure itself by writing data structures to disk, it will hit the case where the kernel has already paged that memory out, has to reload it, only to write it to disk and free the memory afterwards.
It's a beautifully powerful function :)
https://man7.org/linux/man-pages/man2/mmap.2.html