15 messages in ru.sysoev.nginxRe: Question about proxy cache when i...
FromSent OnAttachments
Jérôme LoyetMay 12, 2009 1:37 am 
"坏人"May 12, 2009 7:26 am 
Igor SysoevMay 12, 2009 7:31 am 
Jérôme LoyetMay 12, 2009 7:35 am 
Jérôme LoyetMay 12, 2009 7:52 am 
"坏人"May 12, 2009 1:18 pm 
Jim OhlsteinMay 12, 2009 1:41 pm 
张立冰May 12, 2009 6:22 pm 
Jérôme LoyetMay 19, 2009 8:13 am 
Igor SysoevMay 20, 2009 5:06 am 
Jérôme LoyetMay 20, 2009 5:32 am 
Igor SysoevMay 20, 2009 5:35 am 
Maxim DouninMay 20, 2009 6:41 am 
Igor SysoevMay 20, 2009 6:44 am 
Arvind JayaprakashJun 10, 2009 10:22 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Question about proxy cache when it expiresActions...
From:Maxim Dounin (mdou@mdounin.ru)
Date:May 20, 2009 6:41:49 am
List:ru.sysoev.nginx

Hello!

On Wed, May 20, 2009 at 04:36:12PM +0400, Igor Sysoev wrote:

On Wed, May 20, 2009 at 02:32:39PM +0200, J?r?me Loyet wrote:

OK

I'll try to look into the code to see what I can do. Do you have any lead to guide me on this quest ? :)

This is complex thing. It requires sending notifications from one worker to another when busy lock is being freed.

BTW, what about something like "in-process" busy locks? This will effectively limit number of requests simulteneously send to backends to number of worker processes. At least it looks much better than nothing, and should be simpler.

2009/5/20 Igor Sysoev <is@rambler-co.ru>:

On Tue, May 19, 2009 at 05:14:11PM +0200, J?r?me Loyet wrote:

On Tue, May 12, 2009 at 10:38:04AM +0200, J?r?me Loyet wrote:

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 :)

Currently all requests which found that a cached response expired are proxied to backend. I plan to implement busy locks to pass the single request and leave others to wait the response up to specified time.

Hi igor,

about this feature. Do you know when you plan do implement it ? I really need this feature. If you don't have enough time, I can look into it if you explain to me briefly how you want to do it.

This is complex thing that I plan to implement in 0.8.