proxy_cache and restarts

Igor Sysoev is at rambler-co.ru
Sat May 2 21:05:38 MSD 2009


On Sat, May 02, 2009 at 11:53:18AM -0500, Resicow wrote:

> Hello,
> 
> I have a question on for nginx handles restarts and proxy_cache.
> 
> Say I have 2 million objects cached, taking up 50GBs of space. Then I 
> get a kernel panic or some other error, and have to restart the physical 
> machine.
> 
> When I start nginx up again the 2 million objects are still on the disk, 
> but nginx no longer has its internal caching table, correct? Are those 
> files just stuck on the disk forever, or do I need to ensure the cache 
> is empty if nginx needs to be restarted by manually deleting the objects?

While starting up workers look up disk cache on demand and update keys
zones in shared memory. Also the cache manager process runs in background,
reads step by step a whole disk cache, and updates the keys zones, too.
After cache manager has read (it may take a long time for 50G) a whole
disk cache, workers use only keys zones to look up existence of responses.
Upon that the cache manager now delete inactive responses and looks after
disk cache size.

> Also on binary upgrades, will the internal proxy cache table survive?

Since keys zones are not shared between old and new processes, the new
workers and cache manager does the same as on start up.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list