| From | Sent On | Attachments |
|---|---|---|
| Jeff Mitchell | Jan 27, 2011 9:07 pm | |
| Ryan Malayter | Jan 28, 2011 7:55 am | |
| Jeff Mitchell | Jan 29, 2011 12:19 am | |
| Jeff Mitchell | Jan 29, 2011 8:05 am | |
| Guzman Braso | Jan 29, 2011 3:57 pm | |
| agentzh | Feb 1, 2011 12:46 am | |
| agentzh | Feb 1, 2011 12:53 am | |
| Ryan Malayter | Feb 1, 2011 7:45 am |
| Subject: | Setting cache parameters via if directives | |
|---|---|---|
| From: | Jeff Mitchell (je...@jefferai.org) | |
| Date: | Jan 27, 2011 9:07:56 pm | |
| List: | ru.sysoev.nginx | |
Hello,
We have a particular application (gitweb) that performs a particular, extraordinarily slow function when the home page is loaded. As the number of repositories has increased, this has grown to take several *minutes* per page view (yes, ugh).
To combat this, we tried setting up cache so that this only occurs once an hour, but it's still causing too much of a problem...both because it doesn't always last an hour (sometimes we see the delay happen again sooner) and because when it does expire, it simply takes too long (and if multiple clients connect at that same time making that request, it gets even worse).
As a result, what I'd like to do is to have the cache expire after an hour, but once every twenty or thirty minutes manually refresh the cache. That way clients can use the existing cache while the new page is being rebuilt, which will then save the new values into the cache and reset the timer.
So my thought was that I could do something like the code below, but it doesn't work since I can't put the directives I want into the if block, and the proxy_pass in the if block (if I remove the cache values) honors the cache values in the outside location block anyways:
location = / { if ($remote_addr = "1.2.3.4") { proxy_pass http://127.0.0.1:80; proxy_cache gitweb; proxy_cache_valid 200 20m; proxy_read_timeout 300; proxy_send_timeout 300; } proxy_pass http://127.0.0.1:80; proxy_cache gitweb; proxy_cache_valid 200 60m; proxy_cache_use_stale off; proxy_read_timeout 60; proxy_send_timeout 60; }
Any help much appreciated.
Thanks, Jeff
_______________________________________________ nginx mailing list ngi...@nginx.org http://nginx.org/mailman/listinfo/nginx





