3 ms·
My web server, filed ( http://filed.rkeene.org/ http://filed.rkeene.org/ ), is faster than nginx for serving static content by doing two things: 1. Only
by rkeene2 11y ago
My web server, filed ( http://filed.rkeene.org/ http://filed.rkeene.org/ ), is faster than nginx for serving static content by doing two things:
1. Only handling static files
2. Being extremely optimized for serving static content
It's very safe as far as I can tell having run it under AFL with no crashes with ASan on as well as having run it in production on the public Internet.
A few of the optimizations I do in "filed" could also be done in nginx, but most would cost too much.
A separate logging thread that is queued to helps a lot and was one of the main reasons for writing "filed" -- my ability to serve files was being slowed by my ability to write logs indicating that I had served something. The downside is that there may be a large queue of unwritten logs in the event of a kernel panic it other unexpected process termination.
Most requests don't even open the file they are serving because "filed" caches open file descriptors -- once the file has been opened it's kept open until cache entry is needed for a newer file.
There are no runtime allocations after startup except for log entries, leading to very consistent performance under loads.