Cache: fix sending of stale responses [Re: nginx Digest, Vol 9, Issue 39]

Davide D'Amico davide.damico at contactlab.com
Tue Jul 20 10:23:25 MSD 2010


On 19/07/10 20.01, nginx-request at nginx.org wrote:
> Send nginx mailing list submissions to
>         nginx at nginx.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://nginx.org/mailman/listinfo/nginx
> or, via email, send a message with subject or body 'help' to
>         nginx-request at nginx.org
> 
> You can reach the person managing the list at
>         nginx-owner at nginx.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of nginx digest..."
> 
> 
> Today's Topics:
> 
>    1. Rewrite Performance Question (Juergen Gotteswinter)
>    2. Re: Rewrite Performance Question (Boris Dolgov)
>    3. Re: nginx-0.8.45 (Phillip Oldham)
>    4. Re: Rewrite Performance Question (Igor Sysoev)
>    5. Re: Rewrite Performance Question (Juergen Gotteswinter)
>    6. Re: nginx-0.8.45 (Igor Sysoev)
>    7. nginx-0.8.46 (Igor Sysoev)
>    8. Re: block robots for some urls (Igor Sysoev)
>    9. Re: Rewrite Performance Question (Edho P Arief)
>   10. Re: nginx-0.8.46 (Maxim Dounin)
>   11. Re: nginx-0.8.46 (iberkner at gmail.com)
>   12. Re: nginx-0.8.46 (iberkner at gmail.com)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 19 Jul 2010 11:59:03 +0200
> From: Juergen Gotteswinter <jg at internetx.de>
> To: nginx at nginx.org
> Subject: Rewrite Performance Question
> Message-ID: <4C4421E7.6060403 at internetx.de>
> Content-Type: text/plain; charset=UTF-8
> 
> Hi,
> 
> come some take a look at these rewrite rules if they are ok regarding
> performance?
> 
> 
>         if ($host = 'forum.de' ) {
>             rewrite ^/(.*)$ http://www.forum.de:81/$1 permanent;
>         }
> 
>         if ($host ~* ^(www\.)??forum\.(at|ch|com|eu|info|net|org)) {
>             rewrite ^(.*)$ http://www.forum.de:81 last;
>         break;
>         }
>    }
> 
> 
> Thanks :)
> 
> Juergen
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 19 Jul 2010 14:20:49 +0400
> From: Boris Dolgov <boris at dolgov.name>
> To: nginx at nginx.org
> Subject: Re: Rewrite Performance Question
> Message-ID:
>         <AANLkTikR88X3iSw_UF8zZDRM8sV7W00mzulYqQ6B_r4F at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> On Mon, Jul 19, 2010 at 1:59 PM, Juergen Gotteswinter <jg at internetx.de> wrote:
>> Hi,
>>
>> come some take a look at these rewrite rules if they are ok regarding
>> performance?
>>
>>
>> ? ? ? ?if ($host = 'forum.de' ) {
>> ? ? ? ? ? ?rewrite ^/(.*)$ http://www.forum.de:81/$1 permanent;
>> ? ? ? ?}
>>
>> ? ? ? ?if ($host ~* ^(www\.)??forum\.(at|ch|com|eu|info|net|org)) {
>> ? ? ? ? ? ?rewrite ^(.*)$ http://www.forum.de:81 last;
>> ? ? ? ?break;
>> ? ? ? ?}
>> ? }
> Hi!
> Never use if ($host ...
> Different servers with different server_names must be used instead:
> server
> {
>     server_name forum.de;
>     location / { rewrite ^ http://www.forum.de:81/$request_uri? premanent; }
> }
> server
> {
>     server_name ~^(www\.)??forum\.(at|ch|com|eu|info|net|org);
>     location / { rewrite ^ http://www.forum.de:81/$request_uri? premanent; }
> }
> 
> 
> --
> Boris Dolgov.
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Mon, 19 Jul 2010 12:09:59 +0100
> From: Phillip Oldham <phill at activityhq.com>
> To: nginx at nginx.org
> Subject: Re: nginx-0.8.45
> Message-ID: <4C443287.9030206 at activityhq.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 13/07/2010 13:02, Igor Sysoev wrote:
>> Changes with nginx 0.8.45                                        13 Jul 2010
>>
>>      *) Feature: ngx_http_xslt_filter improvements.
>>         Thanks to Laurence Rowe.
>>
> 
> Is there any additional information on these improvements?
> --
> 
> *Phillip B Oldham*
> ActivityHQ
> phill at activityhq.com <mailto:phill at theactivitypeople.co.uk>
> 
> ------------------------------------------------------------------------
> 
> *Policies*
> 
> This e-mail and its attachments are intended for the above named
> recipient(s) only and may be confidential. If they have come to you in
> error, please reply to this e-mail and highlight the error. No action
> should be taken regarding content, nor must you copy or show them to anyone.
> 
> This e-mail has been created in the knowledge that Internet e-mail is
> not a 100% secure communications medium, and we have taken steps to
> ensure that this e-mail and attachments are free from any virus. We must
> advise that in keeping with good computing practice the recipient should
> ensure they are completely virus free, and that you understand and
> observe the lack of security when e-mailing us.
> 
> ------------------------------------------------------------------------
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Mon, 19 Jul 2010 15:10:24 +0400
> From: Igor Sysoev <igor at sysoev.ru>
> To: nginx at nginx.org
> Subject: Re: Rewrite Performance Question
> Message-ID: <20100719111024.GC47630 at rambler-co.ru>
> Content-Type: text/plain; charset=koi8-r
> 
> On Mon, Jul 19, 2010 at 02:20:49PM +0400, Boris Dolgov wrote:
> 
>> On Mon, Jul 19, 2010 at 1:59 PM, Juergen Gotteswinter <jg at internetx.de> wrote:
>>> Hi,
>>>
>>> come some take a look at these rewrite rules if they are ok regarding
>>> performance?
>>>
>>>
>>> ? ? ? ?if ($host = 'forum.de' ) {
>>> ? ? ? ? ? ?rewrite ^/(.*)$ http://www.forum.de:81/$1 permanent;
>>> ? ? ? ?}
>>>
>>> ? ? ? ?if ($host ~* ^(www\.)??forum\.(at|ch|com|eu|info|net|org)) {
>>> ? ? ? ? ? ?rewrite ^(.*)$ http://www.forum.de:81 last;
>>> ? ? ? ?break;
>>> ? ? ? ?}
>>> ? }
>> Hi!
>> Never use if ($host ...
>> Different servers with different server_names must be used instead:
>> server
>> {
>>     server_name forum.de;
>>     location / { rewrite ^ http://www.forum.de:81/$request_uri? premanent; }
>> }
>> server
>> {
>>     server_name ~^(www\.)??forum\.(at|ch|com|eu|info|net|org);
>>     location / { rewrite ^ http://www.forum.de:81/$request_uri? premanent; }
>> }
> 
> Also, in the second server it's better to use usual names instead of regex:
> 
>      server_name   forum.at www.forum.at
>                    forum.ch www.forum.ch
>                    ...
>                    ;
> 
> 
> --
> Igor Sysoev
> http://sysoev.ru/en/
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Mon, 19 Jul 2010 13:26:46 +0200
> From: Juergen Gotteswinter <jg at internetx.de>
> To: nginx at nginx.org
> Subject: Re: Rewrite Performance Question
> Message-ID: <4C443676.20005 at internetx.de>
> Content-Type: text/plain; charset=KOI8-R
> 
> Ok :) thanks to both of you
> 
> Juergen
> 
> On 07/19/2010 01:10 PM, Igor Sysoev wrote:
>> On Mon, Jul 19, 2010 at 02:20:49PM +0400, Boris Dolgov wrote:
>>
>>> On Mon, Jul 19, 2010 at 1:59 PM, Juergen Gotteswinter <jg at internetx.de> wrote:
>>>> Hi,
>>>>
>>>> come some take a look at these rewrite rules if they are ok regarding
>>>> performance?
>>>>
>>>>
>>>>        if ($host = 'forum.de' ) {
>>>>            rewrite ^/(.*)$ http://www.forum.de:81/$1 permanent;
>>>>        }
>>>>
>>>>        if ($host ~* ^(www\.)??forum\.(at|ch|com|eu|info|net|org)) {
>>>>            rewrite ^(.*)$ http://www.forum.de:81 last;
>>>>        break;
>>>>        }
>>>>   }
>>> Hi!
>>> Never use if ($host ...
>>> Different servers with different server_names must be used instead:
>>> server
>>> {
>>>     server_name forum.de;
>>>     location / { rewrite ^ http://www.forum.de:81/$request_uri? premanent; }
>>> }
>>> server
>>> {
>>>     server_name ~^(www\.)??forum\.(at|ch|com|eu|info|net|org);
>>>     location / { rewrite ^ http://www.forum.de:81/$request_uri? premanent; }
>>> }
>>
>> Also, in the second server it's better to use usual names instead of regex:
>>
>>      server_name   forum.at www.forum.at
>>                    forum.ch www.forum.ch
>>                    ...
>>                    ;
>>
>>
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Mon, 19 Jul 2010 15:26:57 +0400
> From: Igor Sysoev <igor at sysoev.ru>
> To: nginx at nginx.org
> Subject: Re: nginx-0.8.45
> Message-ID: <20100719112657.GD47630 at rambler-co.ru>
> Content-Type: text/plain; charset=koi8-r
> 
> On Mon, Jul 19, 2010 at 12:09:59PM +0100, Phillip Oldham wrote:
> 
>> On 13/07/2010 13:02, Igor Sysoev wrote:
>>> Changes with nginx 0.8.45                                        13 Jul 2010
>>>
>>>      *) Feature: ngx_http_xslt_filter improvements.
>>>         Thanks to Laurence Rowe.
>>>
>>
>> Is there any additional information on these improvements?
> 
> This is little speedup. Please see 589-sax-private.diff patch on
> http://nginx.org/pipermail/nginx-devel/2010-July/000388.html
> 
> 
> --
> Igor Sysoev
> http://sysoev.ru/en/
> 
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Mon, 19 Jul 2010 15:33:43 +0400
> From: Igor Sysoev <igor at sysoev.ru>
> To: nginx at nginx.org
> Subject: nginx-0.8.46
> Message-ID: <20100719113343.GG47630 at rambler-co.ru>
> Content-Type: text/plain; charset=iso-8859-1
> 
> Changes with nginx 0.8.46                                        19 Jul 2010
> 
>     *) Change: now the "proxy_no_cache", "fastcgi_no_cache",
>        "uwsgi_no_cache", and "s?gi_no_cache" directives affect on a cached
>        response saving only.
> 
>     *) Feature: the "proxy_cache_bypass", "fastcgi_cache_bypass",
>        "uwsgi_cache_bypass", and "s?gi_cache_bypass" directives.
> 
>     *) Bugfix: nginx did not free memory in cache keys zones if there was
>        an error during working with backend: the memory was freed only
>        after inactivity time or on memory low condition.
> 
> 
> --
> Igor Sysoev
> http://sysoev.ru/en/
> 
> 
> 
> ------------------------------
> 
> Message: 8
> Date: Mon, 19 Jul 2010 15:50:36 +0400
> From: Igor Sysoev <igor at sysoev.ru>
> To: nginx at nginx.org
> Subject: Re: block robots for some urls
> Message-ID: <20100719115036.GJ47630 at rambler-co.ru>
> Content-Type: text/plain; charset=koi8-r
> 
> On Thu, Jul 15, 2010 at 01:51:36AM +0300, bvidinli wrote:
> 
>> Hi,
>>
>> I want to block some robots such as google, to access some urls.
>>
>> here is my config:
>>
>>
>>                       # robotlarin gezdigi luzumsuz adresleri blokla... zirt pirt
>> giriyorlar sanki bisey varmis gibi
>>                       set $test "";
>>
>>                       if ($request_filename ~* calendar) {
>>                               set $test "blo";
>>                       }
>>
>>                       if ($http_user_agent ~* google\.com ) {
>>                               set $test "${test}ck1";
>>                       }
>>
>>                       if ($test = "block1" ){
>>                               return 444;
>>                       }
>>
>>
>> this is as described in nginx config, for "and" ing some conditions.
>> but, it do not work now,
> 
>    location ~ calendar {
>        if ($http_user_agent ~* google\.com ) {
>            return 444;
>        }
> 
>        ...
>    }
> 
>    ...
> 
> 
> --
> Igor Sysoev
> http://sysoev.ru/en/
> 
> 
> 
> ------------------------------
> 
> Message: 9
> Date: Mon, 19 Jul 2010 20:49:04 +0700
> From: Edho P Arief <edhoprima at gmail.com>
> To: nginx at nginx.org
> Subject: Re: Rewrite Performance Question
> Message-ID:
>         <AANLkTik2SDhLeHla8VtuvYp9Pqssi5Zil0xHxh03ui4_ at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
> 2010/7/19 Igor Sysoev <igor at sysoev.ru>:
>> Also, in the second server it's better to use usual names instead of regex:
>>
>> ? ? server_name ? forum.at www.forum.at
>> ? ? ? ? ? ? ? ? ? forum.ch www.forum.ch
>> ? ? ? ? ? ? ? ? ? ...
>> ? ? ? ? ? ? ? ? ? ;
>>
> 
> it would be nice if the config supports simple (extended)
> glob(3)-style pattern matching so it would be something like
> 
> server_name {www.,}forum.{at,ch,com,eu,info,net,org};
> 
> which should be automatically expanded into
> 
> www.forum.at
> www.forum.ch
> www.forum.com
> ...
> forum.net
> forum.org
> 
> --
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> 
> 
> 
> ------------------------------
> 
> Message: 10
> Date: Mon, 19 Jul 2010 20:40:26 +0400
> From: Maxim Dounin <mdounin at mdounin.ru>
> To: nginx at nginx.org
> Subject: Re: nginx-0.8.46
> Message-ID: <20100719164026.GK99657 at mdounin.ru>
> Content-Type: text/plain; charset=utf-8
> 
> Hello!
> 
> On Mon, Jul 19, 2010 at 03:33:43PM +0400, Igor Sysoev wrote:
> 
>> Changes with nginx 0.8.46                                        19 Jul 2010
>>
>>     *) Change: now the "proxy_no_cache", "fastcgi_no_cache",
>>        "uwsgi_no_cache", and "s?gi_no_cache" directives affect on a cached
>>        response saving only.
>>
>>     *) Feature: the "proxy_cache_bypass", "fastcgi_cache_bypass",
>>        "uwsgi_cache_bypass", and "s?gi_cache_bypass" directives.
> 
> Russian "?" (in koi8-r, 0xD3) slipped in instead of latin "c" in
> "scgi_no_cache" and "scgi_cache_bypass" directive names (and the
> same in CHANGES and CHANGES.ru).
> 
> Maxim Dounin
> 
> 
> 
> ------------------------------
> 
> Message: 11
> Date: Mon, 19 Jul 2010 17:59:36 +0000
> From: iberkner at gmail.com
> To: nginx at nginx.org
> Subject: Re: nginx-0.8.46
> Message-ID:
>         <781197071-1279562377-cardhu_decombobulator_blackberry.rim.net-1922581859- at bda2313.bisx.prod.on.blackberry>
> 
> Content-Type: text/plain; charset="Windows-1252"
> 
> 
> ------Original Message------
> From: Igor Sysoev
> To: nginx at nginx.org
> ReplyTo: nginx at nginx.org
> Subject: nginx-0.8.46
> Sent: Jul 19, 2010 7:33 AM
> 
> Changes with nginx 0.8.46                                        19 Jul 2010
> 
>     *) Change: now the "proxy_no_cache", "fastcgi_no_cache",
>        "uwsgi_no_cache", and "s?gi_no_cache" directives affect on a cached
>        response saving only.
> 
>     *) Feature: the "proxy_cache_bypass", "fastcgi_cache_bypass",
>        "uwsgi_cache_bypass", and "s?gi_cache_bypass" directives.
> 
>     *) Bugfix: nginx did not free memory in cache keys zones if there was
>        an error during working with backend: the memory was freed only
>        after inactivity time or on memory low condition.
> 
> 
> --
> Igor Sysoev
> http://sysoev.ru/en/
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
> 
> 
> Sent on the Sprint? Now Network from my BlackBerry?
> 
> ------------------------------
> 
> Message: 12
> Date: Mon, 19 Jul 2010 18:00:55 +0000
> From: iberkner at gmail.com
> To: nginx at nginx.org
> Subject: Re: nginx-0.8.46
> Message-ID:
>         <2090767961-1279562455-cardhu_decombobulator_blackberry.rim.net-1651410852- at bda2313.bisx.prod.on.blackberry>
> 
> Content-Type: text/plain; charset="Windows-1252"
> 
> 
> ------Original Message------
> From: Igor Sysoev
> To: nginx at nginx.org
> ReplyTo: nginx at nginx.org
> Subject: nginx-0.8.46
> Sent: Jul 19, 2010 7:33 AM
> 
> Changes with nginx 0.8.46                                        19 Jul 2010
> 
>     *) Change: now the "proxy_no_cache", "fastcgi_no_cache",
>        "uwsgi_no_cache", and "s?gi_no_cache" directives affect on a cached
>        response saving only.
> 
>     *) Feature: the "proxy_cache_bypass", "fastcgi_cache_bypass",
>        "uwsgi_cache_bypass", and "s?gi_cache_bypass" directives.
> 
>     *) Bugfix: nginx did not free memory in cache keys zones if there was
>        an error during working with backend: the memory was freed only
>        after inactivity time or on memory low condition.
> 
> 

Well, after this release, have I still to apply these patches?

http://nginx.org/pipermail/nginx-devel/2010-January/000101.html?
http://nginx.org/pipermail/nginx-devel/2010-January/000102.html

I mean, it seems it's a bug introduced in nginx-devel 0.8.31 and it's 6
months old, so could you apply these patches on the official tree (or
tell me why not)?

Thanks for your work,
d.




More information about the nginx mailing list