How does nginx cache work ?

ujaeek at yahoo.co.jp ujaeek at yahoo.co.jp
Thu Sep 7 08:31:34 UTC 2017


Hi, 

Currently we are modify some nginx proxy cache functions, and I would like to know how nginx cache work?

1. does nginx cache data in memory or read from disk everytime?

for example, first I do `GET /example.jpg`, nginx will cache it and save to disk.
next time I do `GET /example.jpg`, does nginx read the file from disk then send to client, 
or nginx just send the file from memory to client because nginx has cached it in memory ?

2. if nginx save it in memory, what happens if the file is 1GB?

does nginx malloc a 1GB memory and save the file? or split the file into many parts, and save it separately using 
something like array or linked list?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20170907/800272a1/attachment.html>


More information about the nginx-devel mailing list