Hacker News new | ask | show | jobs
by marcosdumay 1374 days ago
> Does Apache/Nginx/IIS load static files in memory ahead of time?

Linux loads them on the first usage. If you have enough memory, they'll just stay there. It doesn't that much memory, most sites are pretty small.

But the article's way doe use less memory, less system calls, and is completely optimized for that one site only. So yeah, it will surely be faster. Besides, his site appears to not be static.

1 comments

> Linux loads them on the first usage.

Yes, but.

The problem with OS file caches has ever been that people look at a box, see that the programs aren't consuming all of the available memory, and argue that they should be able to cram more shit on the box because it's 'underutilized'.

There are very reasonable and sane system architectures that let the OS handle caching, but you need a way to defend against these sorts of situations.

The performance falloff for this failure mode is exponential, so people try it a few times, and not getting any negative feedback, they add it to their toolbox only to get lectured months later once the bad behavior has not only become standard for them but also spread to other people.

It almost begs for a different system call that can earmark the memory usage by the app in a way that's easier for people to see.