[PATCH 0 of 5] cache patches

António P. P. Almeida appa at perusio.net
Mon Dec 12 10:25:34 UTC 2011


On 12 Dez 2011 10h00 WET, mdounin at mdounin.ru wrote:

Hello again,

> The default for proxy_cache_lock_timeout is "5s".

Yes indeed. There's a 5000 there. My fault.

>> proxy_pass http://my_upstream;
>> }
>>
>> 1. Request for /foobar comes in at t=0
>>
>> 2. Additional request for /foobar comes in at t=200ms
>>
>> 3. Additional request for /foobar comes in at t=220ms
>>
>> Requests 2 and 3 are queued by the cache manager. Request 1 is
>> forwarded upstream. When a response arrives, requests 2 and 3 are
>> served.
>
> In the above scenario, request (2) will be served at t=700ms 
> (500ms after request) and request (3) will be served at t=720ms.  
> This is because right now requests use periodic timer (each 500ms) 
> to see if response arrived.

Ok. This is harcoded right now, here I think:

+    if (wait) {
+        ngx_add_timer(ev, (timer > 500) ? 500 : timer);
+        return;
+    }

Can we not make this a user defined setting? E.g.:

proxy_cache_lock_request_period <value ms>; # defaults to 500

I don't know if making this period user defined will have consequences
down the line in other cache manager code.

Just an idea.

Thanks,
--- appa






> If a response doesn't arrive at all, at 5s200ms (after 
> proxy_cache_lock_timeout) request (2) will be allowed to go to 
> upstream, and at 5s220ms request (3) will be allowed to go to 
> upstream.  That is, proxy_cache_lock_timeout is a per-request 
> safeguard timeout.
>
>> For the moment the cache entries that are updating will use the
>> current 'proxy_cache_use_stale updating' setting.
>
> Yes.
>
> Maxim Dounin
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel



More information about the nginx-devel mailing list