News for hackers. Stuff that matters.
Re:35% Faster Than The Filesystem (2017) by perspective1 on Sunday August 18, 2019 @09:58AM (#20730158)
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?
Re:35% Faster Than The Filesystem (2017) by majewsky on Sunday August 18, 2019 @02:15PM (#20731845)
> 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.
Re:35% Faster Than The Filesystem (2017) by zaroth on Sunday August 18, 2019 @10:20AM (#20730260)
If 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.

Re:35% Faster Than The Filesystem (2017) by zzzcpan on Sunday August 18, 2019 @12:08PM (#20731025)
Nginx 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.