Is cache being used?

egrueda nginx-forum at nginx.us
Tue Jul 26 16:23:40 UTC 2011


The more I test, the more confused I am :-(
I'm using httperf tool to make performance testing, and when I launch a
10 requests test, I see 10 responses in nginx logs with code 200, but I
also see the same 10 responses with 200 code in backend 'real' server.
Why is it asking backend servers again if it already has a 200 response
for the same request?

Please, help me understand it.

I am using these settings:

---
## Proxy options
proxy_buffering           on;
proxy_cache_min_uses       3;
proxy_cache_valid         any 10m;
proxy_ignore_client_abort off;
proxy_intercept_errors  on;
proxy_next_upstream     error timeout invalid_header;
proxy_redirect          off;
proxy_set_header        Host $host;
proxy_set_header        X-Real-IP $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout   60;
proxy_send_timeout      60;
proxy_read_timeout      60;

## Cache Paths
proxy_cache_path        /usr/local/nginx/cache/common levels=1:2
keys_zone=cache:10m inactive=10m max_size=1000M;

server {
        server_name example.com www.example.com;
        access_log /var/log/nginx/example.access.log;
        location / {
                proxy_pass              http://11.22.33.44:80;
                proxy_cache             cache;
                proxy_cache_valid       200  1d;
                proxy_cache_use_stale   error timeout invalid_header
updating http_500 http_502 http_503 http_504;

        }
}
---

==> /var/log/nginx/example.access.log <== (frontend server)
10.11.12.13 - - [26/Jul/2011:18:16:07 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:07 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:07 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:07 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:08 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:08 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:08 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:08 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:08 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:09 +0200] "GET / HTTP/1.1" 200 103124
"-" "httperf/0.9.0"

==> /var/log/httpd/example.access.log <== (backend server)
10.11.12.13 - - [26/Jul/2011:18:16:06 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:06 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:07 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:07 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:06 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:06 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:06 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:07 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:06 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"
10.11.12.13 - - [26/Jul/2011:18:16:07 +0200] "GET / HTTP/1.0" 200 103606
"-" "httperf/0.9.0"

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,212954,212956#msg-212956



More information about the nginx mailing list