Nginx-0.7.44

On Mon, Mar 23, 2009 at 05:57:27PM +0300, Igor S. wrote:

                    inactive=5m     clean_time=2h00m;

         proxy_cache_min_uses  1;

         proxy_cache_use_stale   error  timeout invalid_header http_500;
     }
 }

The cache currently ignores backend’s Cache-Control, Expires, etc.

The attached patch enables caching for FastCGI. The directives are the
same
as in proxy cache, just change proxy_ prefix to fastcgi_ one. Plus

fastcgi_cache_key 127.0.0.1:9000$request_uri;

to evaluate unique key in cache. In proxy the key is evalueyed intrnally
is something like

$schema$proxy_host:$proxy_port$uri$is_args$args

2009/3/23 Igor S. [email protected]:

to inlcudes and binary libraries.

(MD5_Init vs MD5Init).
–with-http_stub_status_module --with-http_sub_module

  • OpenSSL library is not used
    not <openssl/md5.h>
    How to tell to configure script to lookup in /usr/local/openssl-0.9.6
    for headers and lib from openssl ?

This may be not include problem, but library’s one.
Where is md5.h and libcrypto.so on your system:

/usr/local/openssl-0.9.6/include/openssl/md5.h
/usr/local/openssl-0.9.6/lib/libcrypto.so

?

I found a small bug which caused my death on this :slight_smile:

— auto/feature.orig Mon Mar 23 18:40:55 2009
+++ auto/feature Mon Mar 23 18:41:11 2009
@@ -39,7 +39,7 @@

ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \

  •      -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT 
    

$ngx_feature_libs"

  •      -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_CC_OPT $NGX_LD_OPT
    

$ngx_feature_libs"

ngx_feature_inc_path=

In auto/feature the NGX_CC_OPT variable (from --with-cc-opt configure
option) was not used. So I could set whatever I wanted through
–with-cc-opt it would never be looked at.

now everything works fine. In my case I have to specify both
with-cc-opt and with-cc-opt:
–with-cc-opt=-I/usr/local/openssl-0.9.6/include
–with-ld-opt=-L/usr/local/openssl-0.9.6/lib

Does this patch sound good to you igor ?

++ Jerome

On Mon, Mar 23, 2009 at 06:51:50PM +0100, J?r?me Loyet wrote:

#else
any clue ? I’m still searching
And a part of the output:
š + using system zlib library
#include <openssl/md5.h>
This may be not include problem, but library’s one.
+++ auto/feature Mon Mar 23 18:41:11 2009

In auto/feature the NGX_CC_OPT variable (from --with-cc-opt configure
option) was not used. So I could set whatever I wanted through
–with-cc-opt it would never be looked at.

now everything works fine. In my case I have to specify both
with-cc-opt and with-cc-opt:
–with-cc-opt=-I/usr/local/openssl-0.9.6/include
–with-ld-opt=-L/usr/local/openssl-0.9.6/lib

Does this patch sound good to you igor ?

The $CC_TEST_FLAGS should have $NGX_CC_OPT.
What is in objs/autoconf.err ?

2009/3/23 Igor S. [email protected]:

                   inactive=5m     clean_time=2h00m;

        proxy_cache_min_uses  1;

        proxy_cache_use_stale   error  timeout invalid_header http_500;
    }
}

The cache currently ignores backend’s Cache-Control, Expires, etc.

hi Igor,

Do I understand correctly the proxy_cache_use_stale directive:

proxy_cache_use_stale error timeout invalid_header http_500;

If cache is still valid {
serve content from cache
} else {
Ask fresh data to the backend
if connection status IS IN (proxy_cache_use_stale parameters) {
serve content from cache
} else {
act as normal
}
}

thx
++ jerome

On Tue, Mar 24, 2009 at 05:07:23PM +0100, J?r?me Loyet wrote:

š š š š š š š š š š š škeys_zone=NAME:10m
š š š š š š proxy_cache_valid š any š š š1m;

} else {
act as normal
}
}

Yes.

2009/3/23 Igor S. [email protected]:

#if (NGX_HAVE_OPENSSL_MD5_H)

–with-cc-opt=-I/usr/local/openssl-0.9.6/include

  • md5 library is not found

for headers and lib from openssl ?

ngx_feature_inc_path=

Does this patch sound good to you igor ?

The $CC_TEST_FLAGS should have $NGX_CC_OPT.
What is in objs/autoconf.err ?

Hum … it seems that yesterday I smoked some very good stuff. As I
tried many things I got confused myself … I don’t know why the hell
I found a bug there as it was working … I’m very sorry to have you
spent some time on my problem which even didn’t exist (except in my
smoked mind :p)

Thanks you
++ Jerome

2009/3/24 Igor S. [email protected]:

http {
proxy_cache_valid 200 302 1h;

if connection status IS IN (proxy_cache_use_stale parameters) {
serve content from cache
} else {
act as normal
}
}

Yes.

Other question, how can I determine the maximum number of cache entrie
I have with a particular conf ?

proxy_cache_path /data/nginx/cache keys_zone=one:10m;

What is the size of keys on shared mem (X bytes). So that I can
extrapole the maximum number N of cache entries with YMo of shared
memory (N = (Y x 1024 x 1024) / X). (if there is nothing elese in the
shared mem and if the key size is constant)

Thx
++ jerome

2009/3/24 Igor S. [email protected]:

}

serve content from cache

The key size is 128 bytes.
Thanks for the answer.

Is there a way to know the effective used size in the SHM segement ?

Another question about proxy_cache_valid. Let say I set it to 10m. I
do some hits and the requests are cached well. Now I update my conf
and set proxy_cache_valid to 30s and send a HUP signal to nginx. How
is already cached files timeout handled at restart or reload ?

Is the cache going to be mark as stale 30s after ?
Is the cache going to stay in the cache until its 10m timeout is
reached (and then be recached with a 30s timeout) ?

Thanks you very much. This cache module for proxy is just what we were
waiting for :slight_smile:

++ Jerome

On Tue, Mar 24, 2009 at 07:22:03PM +0100, J?r?me Loyet wrote:

The key size is 128 bytes.

Thanks for the answer.

Is there a way to know the effective used size in the SHM segement ?

No, if shared memory is overflowed you will see in error_log the
message:
“ngx_slab_alloc(): failed”. The problem is that currently no way to see
what memory zone is overflowed: no name and subsystem (proxy cache,
ssl_session_cache, limit requests, etc.) I’m going to fix this.

Another question about proxy_cache_valid. Let say I set it to 10m. I
do some hits and the requests are cached well. Now I update my conf
and set proxy_cache_valid to 30s and send a HUP signal to nginx. How
is already cached files timeout handled at restart or reload ?

Is the cache going to be mark as stale 30s after ?
Is the cache going to stay in the cache until its 10m timeout is
reached (and then be recached with a 30s timeout) ?

The second. The valid time is stored in both memory and file as
now + proxy_cache_valid. Therefore, a response will be valid
for 10m after its creation, and then will be recached for 30s.

On Tue, Mar 24, 2009 at 05:30:02PM +0100, J?r?me Loyet wrote:

The cache currently ignores backend’s Cache-Control, Expires, etc.
š Ask fresh data to the backend
I have with a particular conf ?

proxy_cache_path /data/nginx/cache keys_zone=one:10m;

What is the size of keys on shared mem (X bytes). So that I can
extrapole the maximum number N of cache entries with YMo of shared
memory (N = (Y x 1024 x 1024) / X). (if there is nothing elese in the
shared mem and if the key size is constant)

The key size is 128 bytes.

On Mar 25, 2009, at 18:16 , Igor S. wrote:

memory (N = (Y x 1024 x 1024) / X). (if there is nothing elese in
message:
“ngx_slab_alloc(): failed”. The problem is that currently no way to
see
what memory zone is overflowed: no name and subsystem (proxy cache,
ssl_session_cache, limit requests, etc.) I’m going to fix this.

Would it be possible to somehow add this into the status module, so
it’s possible to graph both disk allocation and other stats such as
hits/misses?

On Wed, Mar 25, 2009 at 06:36:38PM +0100, Johan Bergstr?m wrote:

Is there a way to know the effective used size in the SHM segement ?
hits/misses?
Only when the full featured status module will be introduced.