4 ms·
My (naive?) view is that Nginx caches static files by default after the first hit so the inconvenience isn't worth it in my web apps. Would I really see an impr
by perspective1 7y ago
My (naive?) view is that Nginx caches static files by default after the first hit so the inconvenience isn't worth it in my web apps. Would I really see an improvement switching to a SQLite-esque file system?
- zaroth 7y agoIf the files are being handled programmatically, pull them as byte[] directly from the database. Once I tried to hookup a way to serve the files directly from the DB through IIS, and it was a total failure. By the time I had figured out getting all the various headers right, I was still running into some weird caching issue that would corrupt the request at random intervals. So now, if the files are static hosting assets, I will initialize a ‘cache/‘ folder on the local filesystem (for that machine on the web-farm) when the first request comes in and just read all those files back into the local file system for the web server to handle. The only remaining concern is refreshing the cache when files change in the DB.
- zzzcpan 7y agoNginx doesn't cache files by default, but it has a file based caching module and a file based store module that can be used to retrieve files from backends and cache on local filesystem.
- majewsky 7y ago> My (naive?) view is that Nginx caches static files by default after the first hit That's likely the OS's filesystem cache, not anything in nginx. If you're on Linux, you can confirm this by clearing the OS filesystem cache with $ sudo -i # echo 3 > /proc/sys/vm/drop_caches and checking if the next hit on your URL looks like a cold load.