News for hackers. Stuff that matters.
Re:Rearchitecting GitHub Pages by vog on Wednesday May 27, 2015 @11:31AM (#9612068)
I believe this is automatically done by the operating system. Nginx usually performs some kind of mmap of the requested file, and the virtual memory management will automatically take care of caching.

BTW, I'm often surprised how people are afraid from opening files from their scripts, as if they think this will always lead to disk access. Then, they start implementing a hand-written caching layer on top of that, which usually performs worse than what the OS already offers.

Re:Rearchitecting GitHub Pages by falcolas on Wednesday May 27, 2015 @12:49PM (#9612645)
If it's a static file with no dynamic compression (nginx allows the use of pre-compressed assets) or SSL, nginx doesn't even have to open the file, it just uses the sendfile system call.
Re:Rearchitecting GitHub Pages by shanemhansen on Wednesday May 27, 2015 @02:35PM (#9613420)
Minor nit. The sendfile system call requires an open file. nginx can just skip reading the file contents into userspace.

Also, BSD has some recent extensions to make sendfile work with ssl [https://people.freebsd.org/~rrs/asiabsd_2015_tls.pdf] (pdf)