It also precaches gzipped and brotli'd versions of sensible files so that it can accept-encoding for a variety of browsers.
I see it as a pragmatic trade off between speed and RAM. Even free tier EC2 instance should have enough RAM to handle pretty much any SPA even if the text content is duplicated (compressed) especially seeing as with a unikernel you have no RAM used up by Linux processes.
If you're really concerned you can MMAP the file instead, and do a read every once in a while to keep it cached.
There are a lot of cases where this kind of functionality could cause big problems, and very few where it has more than a marginal improvement over what your OS is already doing. Just read the file every once in a while to keep it in memory cache.
Given that point, I got the impression that the comparison was against loading resources from S3. The difference between that and serving from memory (even between that and serving from uncached traditional hard-drive) is going to be significant.
EDIT: cursory research suggests S3 latency (https://stackoverflow.com/a/861539/114292, being the most recent reference that turned up) is smaller than it was last time I remember needing to look into it, but still of the order of 10+ms.
Some things we might have 1000+ checkboxs to work through on a checklist (cut down by some initial tailoring steps). Even things with a small wait on a click etc are frustrating. If you can drive using a keyboard shortcut and get very immediate response you can really move through things.
Latency Numbers Everyone Should Know: https://static.googleusercontent.com/media/sre.google/en//st...
sendfile(2): https://man7.org/linux/man-pages/man2/sendfile.2.html
(It's negated by the SSL handshake, but that's another discussion...)
I ask because those numbers seem really off.
Plus, like you said, 10-20ms extra on top of the actual latency from the server is not going to make any difference to the end user.
There are use cases where you probably need something like Nginx or whatever to handle lots of requests without a CDN but these are rare.
Reading assets from files instead of a RAM cache won’t add “10-20ms”. This is measured in microseconds, not milliseconds. Most servers nowadays are using SSDs or eNVM. And as I wrote earlier, the files are likely already cached in RAM by the OS anyway :)
I know. I was just using a hypothetical worst case scenario to exemplify that it doesn't matter.