Configuring varnish and django (apache/modwsgi)
- by Hedde
I am trying to work out why my application keeps hitting the database while I have setup varnish infront of apache. I think I am missing some vital configuration, any tips are welcome
This is my curl result:
HTTP/1.1 200 OK
Server: Apache/2.2.16 (Debian)
Content-Language: en-us
Vary: Accept,Accept-Encoding,Accept-Language,Cookie
Cache-Control: s-maxage=60, no-transform, max-age=60
Content-Type: application/json; charset=utf-8
Date: Sat, 15 Sep 2012 08:19:17 GMT
Connection: keep-alive
My varnishlog:
13 BackendClose - apache
13 BackendOpen b apache 127.0.0.1 47665 127.0.0.1 8000
13 TxRequest b GET
13 TxURL b /api/v1/events/?format=json
13 TxProtocol b HTTP/1.1
13 TxHeader b User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
13 TxHeader b Host: foobar.com
13 TxHeader b Accept: */*
13 TxHeader b X-Forwarded-For: 92.64.200.145
13 TxHeader b X-Varnish: 979305817
13 TxHeader b Accept-Encoding: gzip
13 RxProtocol b HTTP/1.1
13 RxStatus b 200
13 RxResponse b OK
13 RxHeader b Date: Sat, 15 Sep 2012 08:21:28 GMT
13 RxHeader b Server: Apache/2.2.16 (Debian)
13 RxHeader b Content-Language: en-us
13 RxHeader b Content-Encoding: gzip
13 RxHeader b Vary: Accept,Accept-Encoding,Accept-Language,Cookie
13 RxHeader b Cache-Control: s-maxage=60, no-transform, max-age=60
13 RxHeader b Content-Length: 6399
13 RxHeader b Content-Type: application/json; charset=utf-8
13 Fetch_Body b 4(length) cls 0 mklen 1
13 Length b 6399
13 BackendReuse b apache
11 SessionOpen c 92.64.200.145 53236 :80
11 ReqStart c 92.64.200.145 53236 979305817
11 RxRequest c HEAD
11 RxURL c /api/v1/events/?format=json
11 RxProtocol c HTTP/1.1
11 RxHeader c User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
11 RxHeader c Host: foobar.com
11 RxHeader c Accept: */*
11 VCL_call c recv lookup
11 VCL_call c hash
11 Hash c /api/v1/events/?format=json
11 Hash c foobar.com
11 VCL_return c hash
11 VCL_call c miss fetch
11 Backend c 13 apache apache
11 TTL c 979305817 RFC 60 -1 -1 1347697289 0 1347697288 0 60
11 VCL_call c fetch deliver
11 ObjProtocol c HTTP/1.1
11 ObjResponse c OK
11 ObjHeader c Date: Sat, 15 Sep 2012 08:21:28 GMT
11 ObjHeader c Server: Apache/2.2.16 (Debian)
11 ObjHeader c Content-Language: en-us
11 ObjHeader c Content-Encoding: gzip
11 ObjHeader c Vary: Accept,Accept-Encoding,Accept-Language,Cookie
11 ObjHeader c Cache-Control: s-maxage=60, no-transform, max-age=60
11 ObjHeader c Content-Type: application/json; charset=utf-8
11 Gzip c u F - 6399 69865 80 80 51128
11 VCL_call c deliver deliver
11 TxProtocol c HTTP/1.1
11 TxStatus c 200
11 TxResponse c OK
11 TxHeader c Server: Apache/2.2.16 (Debian)
11 TxHeader c Content-Language: en-us
11 TxHeader c Vary: Accept,Accept-Encoding,Accept-Language,Cookie
11 TxHeader c Cache-Control: s-maxage=60, no-transform, max-age=60
11 TxHeader c Content-Type: application/json; charset=utf-8
11 TxHeader c Date: Sat, 15 Sep 2012 08:21:29 GMT
11 TxHeader c Connection: keep-alive
11 Length c 0
11 ReqEnd c 979305817 1347697288.292612076 1347697289.456128597 0.000086784 1.163468122 0.000048399