why is proxy_cache_lock not working?

edanic0017 nginx-forum at forum.nginx.org
Fri Nov 17 06:49:45 UTC 2017


I am running nginx server in front of httpd server.

nginx -V
nginx version: nginx/1.10.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx
--modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy
--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi
--http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi
--http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid
--lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx
--with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module
--with-http_realip_module --with-http_addition_module
--with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic
--with-http_geoip_module=dynamic --with-http_sub_module
--with-http_dav_module --with-http_flv_module --with-http_mp4_module
--with-http_gunzip_module --with-http_gzip_static_module
--with-http_random_index_module --with-http_secure_link_module
--with-http_degradation_module --with-http_slice_module
--with-http_stub_status_module --with-http_perl_module=dynamic
--with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit
--with-stream=dynamic --with-stream_ssl_module --with-debug
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
--with-ld-opt=' -Wl,-E'



Below are the parts of the nginx configuration


proxy_cache_path    /tmp/nginx/cache             
                    levels=1:2                            
                    keys_zone=my_cache:1m       
                    max_size=10g                  
                    inactive=30s                  
                    use_temp_path=off;            

    location ~*\.(ts)$ {

             ##### Proxy cache settings

             proxy_http_version 1.1;
             proxy_cache my_cache;
             proxy_cache_revalidate on;
             proxy_cache_key $uri;
             proxy_cache_use_stale updating;
             proxy_cache_valid any 1m;
             proxy_cache_min_uses 1;
             proxy_cache_lock on;
             proxy_cache_lock_age 5s;
             proxy_cache_lock_timeout 1h;
             proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
             proxy_ignore_headers Set-Cookie;


                proxy_pass http://192.168.2.225:8080;
    }


Even with proxy_cache_lock on, the original server is getting hit on every
miss request per the logs below.

nginx access logs:

HOST82 - MISS [17/Nov/2017:00:22:03 -0600] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 206 262144 "-" "Roku/DVP-8.0
(298.00E04108A)" "-"
HOST225 - MISS [17/Nov/2017:00:22:04 -0600] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 206 262144 "-" "Roku/DVP-8.0
(508.00E03138A)" "-"
HOST187 - MISS [17/Nov/2017:00:22:05 -0600] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 200 4696992 "-" "Roku/DVP-7.70
(047.70E04135A)" "-"
HOST125 - MISS [17/Nov/2017:00:22:06 -0600] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 206 262144 "-" "Roku/DVP-8.0
(248.00E04108A)" "-"
HOST80 - MISS [17/Nov/2017:00:22:08 -0600] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 206 262144 "-" "Roku/DVP-8.0
(288.00E04108A)" "-"

HOST80 - MISS [17/Nov/2017:00:22:15 -0600] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 206 262144 "-" "Roku/DVP-8.0
(288.00E04108A)" "-"
HOST82 - MISS [17/Nov/2017:00:22:16 -0600] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 206 262144 "-" "Roku/DVP-8.0
(298.00E04108A)" "-"
HOST225 - MISS [17/Nov/2017:00:22:18 -0600] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 206 262144 "-" "Roku/DVP-8.0
(508.00E03138A)" "-"
HOST187 - MISS [17/Nov/2017:00:22:19 -0600] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 200 4527604 "-" "Roku/DVP-7.70
(047.70E04135A)" "-"


Origin httpd logs

192.168.2.226 - - [17/Nov/2017:06:29:40 +0000] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 200 4696992
192.168.2.226 - - [17/Nov/2017:06:29:41 +0000] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 200 4696992
192.168.2.226 - - [17/Nov/2017:06:29:42 +0000] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 200 4696992
192.168.2.226 - - [17/Nov/2017:06:29:43 +0000] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 200 4696992
192.168.2.226 - - [17/Nov/2017:06:29:45 +0000] "GET
profile1/76861/HD_profile1_00001.ts HTTP/1.1" 200 4696992

192.168.2.226 - - [17/Nov/2017:06:29:52 +0000] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 200 4527604
192.168.2.226 - - [17/Nov/2017:06:29:53 +0000] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 200 4527604
192.168.2.226 - - [17/Nov/2017:06:29:55 +0000] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 200 4527604
192.168.2.226 - - [17/Nov/2017:06:29:56 +0000] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 200 4527604
192.168.2.226 - - [17/Nov/2017:06:29:56 +0000] "GET
profile1/76861/HD_profile1_00002.ts HTTP/1.1" 200 4527604

192.168.2.226 - - [17/Nov/2017:06:30:03 +0000] "GET
profile1/76861/HD_profile1_00003.ts HTTP/1.1" 200 4866004
192.168.2.226 - - [17/Nov/2017:06:30:05 +0000] "GET
profile1/76861/HD_profile1_00003.ts HTTP/1.1" 200 4866004
192.168.2.226 - - [17/Nov/2017:06:30:05 +0000] "GET
profile1/76861/HD_profile1_00003.ts HTTP/1.1" 200 4866004
192.168.2.226 - - [17/Nov/2017:06:30:07 +0000] "GET
profile1/76861/HD_profile1_00003.ts HTTP/1.1" 200 4866004
192.168.2.226 - - [17/Nov/2017:06:30:08 +0000] "GET
profile1/76861/HD_profile1_00003.ts HTTP/1.1" 200 4866004


What am I missing?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,277358,277358#msg-277358



More information about the nginx mailing list