caching php
Cedric Tabary
tabary at efrei.fr
Wed Oct 11 16:29:15 CEST 2006
On 11/10/2006 16:17, Anton Stonor wrote:
> Cedric Tabary wrote:
>
> >I removed the -t 1200, but my php is still cached !
>
> Well, maybe the HTTP headers from the backend invites Varnish to cache.
> Or there _could_ be a bug in Varnish.
>
> Could you post an example HTTP header of an object you expect Varnish
> not to cache?
I have a simple php script as example :
time.php:
<?
echo time();
?>
Here are the headers from the backend directly :
root at php10:~/varnish-cache% HEAD http://127.0.0.1:8080/time.php
200 OK
Connection: close
Date: Wed, 11 Oct 2006 14:20:08 GMT
Server: Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.7g
Content-Type: text/html; charset=iso-8859-1
Client-Date: Wed, 11 Oct 2006 14:20:08 GMT
Client-Peer: 127.0.0.1:8080
Client-Response-Num: 1
X-Powered-By: PHP/4.4.2
And the headers through varnish :
root at php10:~/varnish-cache% HEAD http://127.0.0.1/time.php
200 OK
Connection: close
Date: Wed, 11 Oct 2006 14:22:42 GMT
Via: 1.1 varnish
Age: 5
Server: Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.7g
Content-Length: 10
Content-Type: text/html; charset=iso-8859-1
Client-Date: Wed, 11 Oct 2006 14:22:47 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
X-Powered-By: PHP/4.4.2
X-Varnish: 1281745475 1281745470
I also managed to get a log of varnish inserting the php script in cache :
12 SessionOpen c 127.0.0.1 36672
12 ReqStart c 127.0.0.1 36672 1281745566
12 RxRequest c HEAD
12 RxURL c /time.php
12 RxProtocol c HTTP/1.1
12 RxHeader c Connection: close
12 RxHeader c Host: 127.0.0.1
12 RxHeader c User-Agent: lwp-request/2.06
12 VCL_call c recv
12 VCL_return c lookup
12 VCL_call c miss
12 VCL_return c fetch
15 BackendOpen b default 127.0.0.1 24543 127.0.0.1 8080
15 BackendXID b 1281745566
12 Backend c 15 default
15 TxRequest b GET
15 TxURL b /time.php
15 TxProtocol b HTTP/1.1
15 TxHeader b Host: 127.0.0.1
15 TxHeader b User-Agent: lwp-request/2.06
15 TxHeader b X-Varnish: 1281745566
15 TxHeader b X-Forwarded-for: 127.0.0.1
15 RxProtocol b HTTP/1.1
15 RxStatus b 200
15 RxResponse b OK
15 RxHeader b Date: Wed, 11 Oct 2006 14:29:19 GMT
15 RxHeader b Server: Apache/1.3.34 (Unix) PHP/4.4.2
mod_ssl/2.8.25 OpenSSL/0.9.7g
15 RxHeader b X-Powered-By: PHP/4.4.2
15 RxHeader b Connection: close
15 RxHeader b Transfer-Encoding: chunked
15 RxHeader b Content-Type: text/html; charset=iso-8859-1
12 TTL c 1281745566 RFC 120 1160576959 1160576959 0 0 0
12 VCL_call c fetch
12 VCL_return c insert
12 ObjProtocol c HTTP/1.1
12 ObjStatus c 200
12 ObjResponse c OK
12 ObjHeader c Date: Wed, 11 Oct 2006 14:29:19 GMT
12 ObjHeader c Server: Apache/1.3.34 (Unix) PHP/4.4.2
mod_ssl/2.8.25 OpenSSL/0.9.7g
12 ObjHeader c X-Powered-By: PHP/4.4.2
12 ObjHeader c Content-Type: text/html; charset=iso-8859-1
12 ObjHeader c Content-Length: 10
15 BackendClose b default
12 Length c 10
12 TxProtocol c HTTP/1.1
12 TxStatus c 200
12 TxResponse c OK
12 TxHeader c Date: Wed, 11 Oct 2006 14:29:19 GMT
12 TxHeader c Server: Apache/1.3.34 (Unix) PHP/4.4.2
mod_ssl/2.8.25 OpenSSL/0.9.7g
12 TxHeader c X-Powered-By: PHP/4.4.2
12 TxHeader c Content-Type: text/html; charset=iso-8859-1
12 TxHeader c Content-Length: 10
12 TxHeader c X-Varnish: 1281745566
12 TxHeader c Age: 0
12 TxHeader c Via: 1.1 varnish
12 TxHeader c Connection: close
12 ReqEnd c 1281745566 1160576959.257762000
1160576959.258505000 0.002817000 0.000721000 0.000022000
0 StatAddr 127.0.0.1 0 397 11 11 0 0 3 3218 0
12 SessionClose c Connection: close
12 StatSess c 127.0.0.1 36672 0 1 1 0 0 1 284 0
Cédric
More information about the varnish-misc
mailing list