You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Pranav Modi <pr...@lukup.com> on 2010/06/24 08:11:25 UTC

Caching not working

Hi,

I have got a proxy running using ATS. The sole entry in remap.config is -

map http://localhost:8080/ http://localhost:8282/

However caching does not take place. Every query i make is redirected to the
origin server. The contents of storage.config is -

/usr/local/trafficserver/cache 134217728

A cache.db file in that location exists. But, the value of the cache size -
proxy.process.cache.bytes_total is shown as 0. What do I need to do to make
caching work?

Thanks,
Pranav.

Re: Caching not working

Posted by Leif Hedstrom <zw...@apache.org>.
On 6/24/10 12:11 AM, Pranav Modi wrote:
> Hi,
>
> I have got a proxy running using ATS. The sole entry in remap.config is -
>
> map http://localhost:8080/ http://localhost:8282/
>
> However caching does not take place. Every query i make is redirected 
> to the origin server. The contents of storage.config is -
>
> /usr/local/trafficserver/cache 134217728
>
> A cache.db file in that location exists. But, the value of the cache 
> size - proxy.process.cache.bytes_total is shown as 0. What do I need 
> to do to make caching work?
>


What are the Cache-Control: and/or Expires: header sent from the server 
on port 8282? The default settings in records.config requires 
appropriate cache control headers or a Last-Modified: header (for 
heuristics to work). You can "tweak" that by modifying

     CONFIG proxy.config.http.cache.required_headers INT 1

-- Leif




Re: Caching not working

Posted by Bedis 9 <be...@gmail.com>.
Hi,
You should also setup a Last-Modified.

cheers

On Fri, Jun 25, 2010 at 1:36 PM, Pranav Modi <pr...@lukup.com> wrote:
> yeah, I had got the correct page...
> Pranav.
>
> On Fri, Jun 25, 2010 at 4:39 PM, Peter Ondruška <pe...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> Jason is referring to
>> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Cache-control
>> header.
>>
>> Peter
>>
>> On Fri, Jun 25, 2010 at 1:00 PM, Pranav Modi <pr...@lukup.com> wrote:
>> > The headers we send from our server along with the status code are -
>> > MIME-Version
>> > Server
>> > Date
>> > Content-Length
>> > Connection
>> > Content-Type
>> > No directives like 'must-revalidate' or 'no-cache'
>> > Pranav.
>> > On Fri, Jun 25, 2010 at 4:01 PM, Jason Giedymin
>> > <ja...@gmail.com>
>> > wrote:
>> >>
>> >> The content headers must be supplied without directives such as 'must
>> >> revalidate', 'no store', etc. For a full list, see:
>> >> www.w3.org/Protocols/rfc2616/rfc2616-sec14.htm
>> >> Throw us a pastebin with some content header samples?
>> >>
>> >> -Jason
>> >> On Jun 25, 2010, at 2:20 AM, Pranav Modi <pr...@lukup.com> wrote:
>> >>
>> >> The permission settings are fine now, still there is something wrong...
>> >> These are my new settings in storage.config file -
>> >> /usr/local/ts/cache 1048576
>> >> after entering this in storage.config, I created the cache directory
>> >> structure,  changed the permission settings so that 'nobody' is the
>> >> owner
>> >> and is able to read and write files, then started TS.
>> >> Before making the first request after configuring the cache, i checked
>> >> the
>> >> value of - proxy.process.cache.bytes_total which was 1021952 and has
>> >> stayed
>> >> that way after any number of data requests. And the cache is still not
>> >> used,
>> >> the requests are being directed to the origin server each time.
>> >> I checked the /var/log/messages file and there are no errors related to
>> >> permissions. What could be wrong?
>> >> Pranav.
>> >>
>> >>
>> >>
>> >>
>> >> On Thu, Jun 24, 2010 at 12:30 PM, Leif Hedstrom <zw...@apache.org>
>> >> wrote:
>> >>>
>> >>> On 6/24/10 12:51 AM, Pranav Modi wrote:
>> >>>>
>> >>>> cache.db is a read-only file with the owner as 'root'.
>> >>>
>> >>> That is probably the problem. Unless you have modified records.config,
>> >>> that directory you specified for the cache needs to be writeable by
>> >>> "nobody". If the file is owned by "root", it probably means you
>> >>> started
>> >>> traffic_server manually as "root" at some point.
>> >>>
>> >>>> However, no messages in usr/local /var/log/messages. In fact that
>> >>>> file
>> >>>> does not exist. There is only a trafficserver directory at
>> >>>> usr/local/var/log
>> >>>
>> >>> it would be in /var/log/messages. As I've mentioned in another post,
>> >>> "fatal" errors are logged via syslog, which on all Linux systems at
>> >>> least
>> >>> would log the errors in /var/log/messages.
>> >>>
>> >>> -- leif
>> >>>
>> >>
>> >
>> >
>
>

Re: Caching not working

Posted by Pranav Modi <pr...@lukup.com>.
yeah, I had got the correct page...

Pranav.

On Fri, Jun 25, 2010 at 4:39 PM, Peter Ondruška <pe...@gmail.com>wrote:

> Hi,
>
> Jason is referring to
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Cache-control
> header.
>
> Peter
>
> On Fri, Jun 25, 2010 at 1:00 PM, Pranav Modi <pr...@lukup.com> wrote:
> > The headers we send from our server along with the status code are -
> > MIME-Version
> > Server
> > Date
> > Content-Length
> > Connection
> > Content-Type
> > No directives like 'must-revalidate' or 'no-cache'
> > Pranav.
> > On Fri, Jun 25, 2010 at 4:01 PM, Jason Giedymin <
> jason.giedymin@gmail.com>
> > wrote:
> >>
> >> The content headers must be supplied without directives such as 'must
> >> revalidate', 'no store', etc. For a full list, see:
> >> www.w3.org/Protocols/rfc2616/rfc2616-sec14.htm
> >> Throw us a pastebin with some content header samples?
> >>
> >> -Jason
> >> On Jun 25, 2010, at 2:20 AM, Pranav Modi <pr...@lukup.com> wrote:
> >>
> >> The permission settings are fine now, still there is something wrong...
> >> These are my new settings in storage.config file -
> >> /usr/local/ts/cache 1048576
> >> after entering this in storage.config, I created the cache directory
> >> structure,  changed the permission settings so that 'nobody' is the
> owner
> >> and is able to read and write files, then started TS.
> >> Before making the first request after configuring the cache, i checked
> the
> >> value of - proxy.process.cache.bytes_total which was 1021952 and has
> stayed
> >> that way after any number of data requests. And the cache is still not
> used,
> >> the requests are being directed to the origin server each time.
> >> I checked the /var/log/messages file and there are no errors related to
> >> permissions. What could be wrong?
> >> Pranav.
> >>
> >>
> >>
> >>
> >> On Thu, Jun 24, 2010 at 12:30 PM, Leif Hedstrom <zw...@apache.org>
> wrote:
> >>>
> >>> On 6/24/10 12:51 AM, Pranav Modi wrote:
> >>>>
> >>>> cache.db is a read-only file with the owner as 'root'.
> >>>
> >>> That is probably the problem. Unless you have modified records.config,
> >>> that directory you specified for the cache needs to be writeable by
> >>> "nobody". If the file is owned by "root", it probably means you started
> >>> traffic_server manually as "root" at some point.
> >>>
> >>>> However, no messages in usr/local /var/log/messages. In fact that file
> >>>> does not exist. There is only a trafficserver directory at
> usr/local/var/log
> >>>
> >>> it would be in /var/log/messages. As I've mentioned in another post,
> >>> "fatal" errors are logged via syslog, which on all Linux systems at
> least
> >>> would log the errors in /var/log/messages.
> >>>
> >>> -- leif
> >>>
> >>
> >
> >
>

Re: Caching not working

Posted by Peter Ondruška <pe...@gmail.com>.
Hi,

Jason is referring to
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Cache-control
header.

Peter

On Fri, Jun 25, 2010 at 1:00 PM, Pranav Modi <pr...@lukup.com> wrote:
> The headers we send from our server along with the status code are -
> MIME-Version
> Server
> Date
> Content-Length
> Connection
> Content-Type
> No directives like 'must-revalidate' or 'no-cache'
> Pranav.
> On Fri, Jun 25, 2010 at 4:01 PM, Jason Giedymin <ja...@gmail.com>
> wrote:
>>
>> The content headers must be supplied without directives such as 'must
>> revalidate', 'no store', etc. For a full list, see:
>> www.w3.org/Protocols/rfc2616/rfc2616-sec14.htm
>> Throw us a pastebin with some content header samples?
>>
>> -Jason
>> On Jun 25, 2010, at 2:20 AM, Pranav Modi <pr...@lukup.com> wrote:
>>
>> The permission settings are fine now, still there is something wrong...
>> These are my new settings in storage.config file -
>> /usr/local/ts/cache 1048576
>> after entering this in storage.config, I created the cache directory
>> structure,  changed the permission settings so that 'nobody' is the owner
>> and is able to read and write files, then started TS.
>> Before making the first request after configuring the cache, i checked the
>> value of - proxy.process.cache.bytes_total which was 1021952 and has stayed
>> that way after any number of data requests. And the cache is still not used,
>> the requests are being directed to the origin server each time.
>> I checked the /var/log/messages file and there are no errors related to
>> permissions. What could be wrong?
>> Pranav.
>>
>>
>>
>>
>> On Thu, Jun 24, 2010 at 12:30 PM, Leif Hedstrom <zw...@apache.org> wrote:
>>>
>>> On 6/24/10 12:51 AM, Pranav Modi wrote:
>>>>
>>>> cache.db is a read-only file with the owner as 'root'.
>>>
>>> That is probably the problem. Unless you have modified records.config,
>>> that directory you specified for the cache needs to be writeable by
>>> "nobody". If the file is owned by "root", it probably means you started
>>> traffic_server manually as "root" at some point.
>>>
>>>> However, no messages in usr/local /var/log/messages. In fact that file
>>>> does not exist. There is only a trafficserver directory at usr/local/var/log
>>>
>>> it would be in /var/log/messages. As I've mentioned in another post,
>>> "fatal" errors are logged via syslog, which on all Linux systems at least
>>> would log the errors in /var/log/messages.
>>>
>>> -- leif
>>>
>>
>
>

Re: Caching not working

Posted by Mark Nottingham <mn...@yahoo-inc.com>.
Put your URL(s) into http://redbot.org/ -- it will tell you how caches are allowed to behave. 

Cheers,


On 25/06/2010, at 4:00 AM, Pranav Modi wrote:

> The headers we send from our server along with the status code are - 
> 
> MIME-Version
> Server
> Date
> Content-Length
> Connection
> Content-Type
> 
> No directives like 'must-revalidate' or 'no-cache'
> 
> Pranav.
> 
> On Fri, Jun 25, 2010 at 4:01 PM, Jason Giedymin <ja...@gmail.com> wrote:
> The content headers must be supplied without directives such as 'must revalidate', 'no store', etc. For a full list, see:
> www.w3.org/Protocols/rfc2616/rfc2616-sec14.htm
> 
> Throw us a pastebin with some content header samples? 
> 
> -Jason
> 
> On Jun 25, 2010, at 2:20 AM, Pranav Modi <pr...@lukup.com> wrote:
> 
>> The permission settings are fine now, still there is something wrong...
>> These are my new settings in storage.config file - 
>> 
>> /usr/local/ts/cache 1048576
>> 
>> after entering this in storage.config, I created the cache directory structure,  changed the permission settings so that 'nobody' is the owner and is able to read and write files, then started TS. 
>> 
>> Before making the first request after configuring the cache, i checked the value of - proxy.process.cache.bytes_total which was 1021952 and has stayed that way after any number of data requests. And the cache is still not used, the requests are being directed to the origin server each time. 
>> 
>> I checked the /var/log/messages file and there are no errors related to permissions. What could be wrong?
>> 
>> Pranav.
>> 
>> 
>> 
>> 
>> 
>> On Thu, Jun 24, 2010 at 12:30 PM, Leif Hedstrom <zw...@apache.org> wrote:
>> On 6/24/10 12:51 AM, Pranav Modi wrote:
>> cache.db is a read-only file with the owner as 'root'. 
>> That is probably the problem. Unless you have modified records.config, that directory you specified for the cache needs to be writeable by "nobody". If the file is owned by "root", it probably means you started traffic_server manually as "root" at some point.
>> 
>> 
>> However, no messages in usr/local /var/log/messages. In fact that file does not exist. There is only a trafficserver directory at usr/local/var/log
>> 
>> it would be in /var/log/messages. As I've mentioned in another post, "fatal" errors are logged via syslog, which on all Linux systems at least would log the errors in /var/log/messages.
>> 
>> -- leif
>> 
>> 
> 

--
Mark Nottingham       mnot@yahoo-inc.com



Re: Caching not working

Posted by Pranav Modi <pr...@lukup.com>.
The headers we send from our server along with the status code are -

MIME-Version
Server
Date
Content-Length
Connection
Content-Type

No directives like 'must-revalidate' or 'no-cache'

Pranav.

On Fri, Jun 25, 2010 at 4:01 PM, Jason Giedymin <ja...@gmail.com>wrote:

> The content headers must be supplied without directives such as 'must
> revalidate', 'no store', etc. For a full list, see:
> www.w3.org/Protocols/rfc2616/rfc2616-sec14.htm
>
> Throw us a pastebin with some content header samples?
>
> -Jason
>
> On Jun 25, 2010, at 2:20 AM, Pranav Modi <pr...@lukup.com> wrote:
>
> The permission settings are fine now, still there is something wrong...
> These are my new settings in storage.config file -
>
> /usr/local/ts/cache 1048576
>
> after entering this in storage.config, I created the cache directory
> structure,  changed the permission settings so that 'nobody' is the owner
> and is able to read and write files, then started TS.
>
> Before making the first request after configuring the cache, i checked the
> value of - proxy.process.cache.bytes_total which was 1021952 and has stayed
> that way after any number of data requests. And the cache is still not used,
> the requests are being directed to the origin server each time.
>
> I checked the /var/log/messages file and there are no errors related to
> permissions. What could be wrong?
>
> Pranav.
>
>
>
>
>
> On Thu, Jun 24, 2010 at 12:30 PM, Leif Hedstrom < <zw...@apache.org>
> zwoop@apache.org> wrote:
>
>> On 6/24/10 12:51 AM, Pranav Modi wrote:
>>
>>> cache.db is a read-only file with the owner as 'root'.
>>>
>> That is probably the problem. Unless you have modified records.config,
>> that directory you specified for the cache needs to be writeable by
>> "nobody". If the file is owned by "root", it probably means you started
>> traffic_server manually as "root" at some point.
>>
>>
>>  However, no messages in usr/local /var/log/messages. In fact that file
>>> does not exist. There is only a trafficserver directory at usr/local/var/log
>>>
>>
>> it would be in /var/log/messages. As I've mentioned in another post,
>> "fatal" errors are logged via syslog, which on all Linux systems at least
>> would log the errors in /var/log/messages.
>>
>> -- leif
>>
>>
>

Re: Caching not working

Posted by Jason Giedymin <ja...@gmail.com>.
The content headers must be supplied without directives such as 'must  
revalidate', 'no store', etc. For a full list, see:
www.w3.org/Protocols/rfc2616/rfc2616-sec14.htm

Throw us a pastebin with some content header samples?

-Jason

On Jun 25, 2010, at 2:20 AM, Pranav Modi <pr...@lukup.com> wrote:

> The permission settings are fine now, still there is something  
> wrong...
> These are my new settings in storage.config file -
>
> /usr/local/ts/cache 1048576
>
> after entering this in storage.config, I created the cache directory  
> structure,  changed the permission settings so that 'nobody' is the  
> owner and is able to read and write files, then started TS.
>
> Before making the first request after configuring the cache, i  
> checked the value of - proxy.process.cache.bytes_total which was 1021952 
>  and has stayed that way after any number of data requests. And the  
> cache is still not used, the requests are being directed to the  
> origin server each time.
>
> I checked the /var/log/messages file and there are no errors related  
> to permissions. What could be wrong?
>
> Pranav.
>
>
>
>
>
> On Thu, Jun 24, 2010 at 12:30 PM, Leif Hedstrom <zw...@apache.org>  
> wrote:
> On 6/24/10 12:51 AM, Pranav Modi wrote:
> cache.db is a read-only file with the owner as 'root'.
> That is probably the problem. Unless you have modified  
> records.config, that directory you specified for the cache needs to  
> be writeable by "nobody". If the file is owned by "root", it  
> probably means you started traffic_server manually as "root" at some  
> point.
>
>
> However, no messages in usr/local /var/log/messages. In fact that  
> file does not exist. There is only a trafficserver directory at usr/ 
> local/var/log
>
> it would be in /var/log/messages. As I've mentioned in another post,  
> "fatal" errors are logged via syslog, which on all Linux systems at  
> least would log the errors in /var/log/messages.
>
> -- leif
>
>

Re: Caching not working

Posted by Pranav Modi <pr...@lukup.com>.
The permission settings are fine now, still there is something wrong...
These are my new settings in storage.config file -

/usr/local/ts/cache 1048576

after entering this in storage.config, I created the cache directory
structure,  changed the permission settings so that 'nobody' is the owner
and is able to read and write files, then started TS.

Before making the first request after configuring the cache, i checked the
value of - proxy.process.cache.bytes_total which was 1021952 and has stayed
that way after any number of data requests. And the cache is still not used,
the requests are being directed to the origin server each time.

I checked the /var/log/messages file and there are no errors related to
permissions. What could be wrong?

Pranav.





On Thu, Jun 24, 2010 at 12:30 PM, Leif Hedstrom <zw...@apache.org> wrote:

> On 6/24/10 12:51 AM, Pranav Modi wrote:
>
>> cache.db is a read-only file with the owner as 'root'.
>>
> That is probably the problem. Unless you have modified records.config, that
> directory you specified for the cache needs to be writeable by "nobody". If
> the file is owned by "root", it probably means you started traffic_server
> manually as "root" at some point.
>
>
>  However, no messages in usr/local /var/log/messages. In fact that file
>> does not exist. There is only a trafficserver directory at usr/local/var/log
>>
>
> it would be in /var/log/messages. As I've mentioned in another post,
> "fatal" errors are logged via syslog, which on all Linux systems at least
> would log the errors in /var/log/messages.
>
> -- leif
>
>

Re: Caching not working

Posted by Leif Hedstrom <zw...@apache.org>.
On 6/24/10 12:51 AM, Pranav Modi wrote:
> cache.db is a read-only file with the owner as 'root'. 
That is probably the problem. Unless you have modified records.config, 
that directory you specified for the cache needs to be writeable by 
"nobody". If the file is owned by "root", it probably means you started 
traffic_server manually as "root" at some point.

> However, no messages in usr/local /var/log/messages. In fact that file 
> does not exist. There is only a trafficserver directory at 
> usr/local/var/log

it would be in /var/log/messages. As I've mentioned in another post, 
"fatal" errors are logged via syslog, which on all Linux systems at 
least would log the errors in /var/log/messages.

-- leif


Re: Caching not working

Posted by Pranav Modi <pr...@lukup.com>.
cache.db is a read-only file with the owner as 'root'. However, no messages
in usr/local/var/log/messages. In fact that file does not exist. There is
only a trafficserver directory at usr/local/var/log

On Thu, Jun 24, 2010 at 12:12 PM, Leif Hedstrom <zw...@apache.org> wrote:

> On 6/24/10 12:37 AM, Pranav Modi wrote:
>
>> Currently Cache-Control and Expires headers are not being sent from the
>> server on port 8282. And the value of
>> proxy.config.http.cache.required_headers is set as 0. So shouldn't caching
>> work, because 0 means that no headers are required to make the document
>> cacheable?
>>
>
> It should. What are the permissions on the cache.db file? Are there any
> messages in /var/log/messages indicating that it was not able to "enable"
> the disk cache?
>
> -- Leif
>
>
>

Re: Caching not working

Posted by Leif Hedstrom <zw...@apache.org>.
On 6/24/10 12:37 AM, Pranav Modi wrote:
> Currently Cache-Control and Expires headers are not being sent from 
> the server on port 8282. And the value of 
> proxy.config.http.cache.required_headers is set as 0. So shouldn't 
> caching work, because 0 means that no headers are required to make the 
> document cacheable? 

It should. What are the permissions on the cache.db file? Are there any 
messages in /var/log/messages indicating that it was not able to 
"enable" the disk cache?

-- Leif



Re: Caching not working

Posted by Pranav Modi <pr...@lukup.com>.
Currently Cache-Control and Expires headers are not being sent from the
server on port 8282. And the value of proxy.config.http.cache.required_headers
is set as 0. So shouldn't caching work, because 0 means that no headers are
required to make the document cacheable?


Pranav.


On Thu, Jun 24, 2010 at 11:52 AM, Leif Hedstrom <zw...@apache.org> wrote:

> On 6/24/10 12:11 AM, Pranav Modi wrote:
>
>> Hi,
>>
>> I have got a proxy running using ATS. The sole entry in remap.config is -
>>
>> map http://localhost:8080/ http://localhost:8282/
>>
>> However caching does not take place. Every query i make is redirected to
>> the origin server. The contents of storage.config is -
>>
>> /usr/local/trafficserver/cache 134217728
>>
>> A cache.db file in that location exists. But, the value of the cache size
>> - proxy.process.cache.bytes_total is shown as 0. What do I need to do to
>> make caching work?
>>
>>
>
> Also, I should have pointed out, to verify if a request is served out of
> cache or not, add a request header like this:
>
>     Cache-Control: only-if-cached
>
>
> If the request can not be fulfilled with a cache hit, then an error (504 I
> think?) is returned. If it can be fulfilled out of cache, a '200 OK' is
> returned (with the cached header + body).
>
> -- leif
>
>

Re: Caching not working

Posted by Leif Hedstrom <zw...@apache.org>.
On 6/24/10 12:11 AM, Pranav Modi wrote:
> Hi,
>
> I have got a proxy running using ATS. The sole entry in remap.config is -
>
> map http://localhost:8080/ http://localhost:8282/
>
> However caching does not take place. Every query i make is redirected 
> to the origin server. The contents of storage.config is -
>
> /usr/local/trafficserver/cache 134217728
>
> A cache.db file in that location exists. But, the value of the cache 
> size - proxy.process.cache.bytes_total is shown as 0. What do I need 
> to do to make caching work?
>


Also, I should have pointed out, to verify if a request is served out of 
cache or not, add a request header like this:

      Cache-Control: only-if-cached


If the request can not be fulfilled with a cache hit, then an error (504 
I think?) is returned. If it can be fulfilled out of cache, a '200 OK' 
is returned (with the cached header + body).

-- leif