Question about proxy cache when it expires

Jérôme Loyet jerome at
Tue May 12 12:38:04 MSD 2009

Hello igor,

I have a question about the cache behaviour in proxy mode.

I have nginx in front head which redirect to an apache back end. Nginx
caches eveything for M minutes.

If I have a large number of requests for the same page and this page
is cached : nginx returns the cached page ... no problems
After M minutes, the cached page expires
The first request coming after the expiration makes nginx to ask the
backend for refresh
When nginx receives the backend fresh response, it's saved to cache
and then nginx serves the fresh cached page

But what happen between the start of the request to the backend and
the end of the response from the backend ? (let's assume that the
backend serves the page in 5s ... and in 5s I can have a lot of
request to this page).:
- Are the request queued waiting for the backend response ?
- Every request makes try to refresh the cache from the backend ? (in
this case, I have multiple request for the same page to the backend
... I can have a burst of request and my apache can be overflowed by
request -- that's why I'm using nignx with cache).
- Do the requests serve the cached page even if it's expired until the
backend response has been received ?
- Maybe something else :)

Thanks for your answer.

++ jerome

More information about the nginx mailing list