Re: [squid-users] Unable to cache requests from Jetty server

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 17 Oct 2010 22:57:01 +1300

On 17/10/10 18:47, Praveen Swadi wrote:
> What I wanted to show was the request from the Jetty server is never
> cached. Perhaps I should have added the response for each of the
> request to jetty server. i.e. the response I showed for Jetty server
> is the same response for each of the request.
>
> For my test apache server:
> request 1: TCP_MISS
> request 2: TCP_MEM_HIT
> Great!
>
> For the jetty server
> request 1: TCP_MISS
> request 2: TCP_MISS
>
> Does that make sense?

Yes thanks. That makes a lot more sense now.

The obvious thing different is that the Jetty server provides no
content-length information. This could affect cacheability if you have
any size limits on what can be stored.

>
> On Sat, Oct 16, 2010 at 5:18 AM, Amos Jeffries wrote:
>> On 16/10/10 21:52, Praveen Swadi wrote:
>>>
>>> Hi,
>>> Here are headers from a test PHP program, that gets cached in squid
>>> properly.
>>> pswadi:Sites pswadi$ curl -v -o /tmp/def --proxy 192.168.1.102:3128 -u
>>> ps:xxxx 'http://192.168.1.102/~pswadi/cachetest.php?a=b'
>>> * About to connect() to proxy 192.168.1.102 port 3128 (#0)
>>> * Trying 192.168.1.102... connected
>>> * Connected to 192.168.1.102 (192.168.1.102) port 3128 (#0)
>>> * Server auth using Basic with user 'ps'
>>>>
>>>> GET http://192.168.1.102/~pswadi/cachetest.php?a=b HTTP/1.1
>>>> Authorization: Basic xx
>>>> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7
>>>> OpenSSL/0.9.8l zlib/1.2.3
>>>> Host: 192.168.1.102
>>>> Accept: */*
>>>> Proxy-Connection: Keep-Alive
>>>>
>>> % Total % Received % Xferd Average Speed Time Time Time
>>> Current
>>> Dload Upload Total Spent Left
>>> Speed
>>> 0 0 0 0 0 0 0 0 --:--:-- --:--:--
>>> --:--:-- 0* HTTP 1.0, assume close after body
>>> < HTTP/1.0 200 OK
>>> < Date: Sat, 16 Oct 2010 07:16:27 GMT
>>> < Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2
>>> PHP/5.3.2
>>> < X-Powered-By: PHP/5.3.2
>>> < Cache-Control: max-age=120, public
>>> < Expires: Sat, 16 Oct 2010 07:18:29 GMT
>>> < Content-Length: 64
>>> < Content-Type: text/html
>>> < Age: 40
>>> < X-Cache: HIT from pswadi.local
>>> < Via: 1.1 pswadi.local:3128 (squid/2.7.STABLE9)
>>> * HTTP/1.0 connection set to keep alive!
>>> < Connection: keep-alive
>>> * HTTP/1.0 proxy connection set to keep alive!
>>> < Proxy-Connection: keep-alive
>>> <
>>> { [data not shown]
>>> 0 64 0 64 0 0 16439 0 --:--:-- --:--:--
>>> --:--:-- 64000* Connection #0 to host 192.168.1.102 left intact
>>> * Closing connection #0
>>> From squid log
>>> 1287213389.181 1426 192.168.1.102 TCP_REFRESH_MISS/200 477 GET
>>> http://192.168.1.102/%7Epswadi/cachetest.php? - DIRECT/192.168.1.102
>>> text/html
>>> 1287213427.433 0 192.168.1.102 TCP_MEM_HIT/200 485 GET
>>> http://192.168.1.102/%7Epswadi/cachetest.php? - NONE/- text/html
>>>
>>> For the requests coming from Jetty server, I get TCP_MISS.
>>>
>>> pswadi:Sites pswadi$ curl -v --proxy 192.168.1.102:3128 -o /tmp/abc1
>>> -u hadoop:xxxx
>>> 'http://10.10.10.10:8078/dashboard/server/tjx_hosted/2010-10-10T00/2010-10-12T00?reportType=server&customerId=tjx_hosted&startTime=2010-10-10T00&endTime=2010-10-12T00'
>>> * About to connect() to proxy 192.168.1.102 port 3128 (#0)
>>> * Trying 192.168.1.102... connected
>>> * Connected to 192.168.1.102 (192.168.1.102) port 3128 (#0)
>>> * Server auth using Basic with user 'hadoop'
>>>>
>>>> GET
>>>> http://10.10.10.10:8078/dashboard/server/tjx_hosted/2010-10-10T00/2010-10-12T00?reportType=server&customerId=tjx_hosted&startTime=2010-10-10T00&endTime=2010-10-12T00
>>>> HTTP/1.1
>>>> Authorization: Basic xx
>>>> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7
>>>> OpenSSL/0.9.8l zlib/1.2.3
>>>> Host: 10.10.10.10:8078
>>>> Accept: */*
>>>> Proxy-Connection: Keep-Alive
>>>>
>>> % Total % Received % Xferd Average Speed Time Time Time
>>> Current
>>> Dload Upload Total Spent Left
>>> Speed
>>> 0 0 0 0 0 0 0 0 --:--:-- 0:00:04
>>> --:--:-- 0* HTTP 1.0, assume close after body
>>> < HTTP/1.0 200 OK
>>> < Cache-Control: max-age=120, public
>>> < Content-Type: text/plain
>>> < Expires: Sat, 16 Oct 2010 07:21:55 GMT
>>> < Server: Jetty(6.1.25)
>>> < X-Cache: MISS from pswadi.local
>>> < Via: 1.1 pswadi.local:3128 (squid/2.7.STABLE9)
>>> < Connection: close
>>> <
>>> { [data not shown]
>>> 100 22142 0 22142 0 0 4342 0 --:--:-- 0:00:05
>>> --:--:-- 5411* Closing connection #0
>>>
>>> In the squid log
>>>
>>> 1287213595.589 5093 192.168.1.102 TCP_MISS/200 22386 GET
>>>
>>> http://10.10.10.10:8078/dashboard/server/tjx_hosted/2010-10-10T00/2010-10-12T00?
>>> - DIRECT/10.10.10.10 text/plain
>>>
>>> What can be wrong?
>>
>> Why do you think there is a problem? What are you expecting to happen.
>>
>> The data is you have provided show three requests. On one request set a
>> cached object is validated and the server returns a new copy to replace the
>> stored version. A followup request uses the cached object.
>>
>> With a separate request an object which is not cached gets fetched through
>> Squid.
>>
>> Amos

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.8
   Beta testers wanted for 3.2.0.2
Received on Sun Oct 17 2010 - 09:57:08 MDT

This archive was generated by hypermail 2.2.0 : Sun Oct 17 2010 - 12:00:03 MDT