RE: Questions on Apache Caching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tom,

Can you explain further on the "Manual Synchronization" process? 
Do I have to manually copy paste the static files from backend server to my local cache folder(create a mirror copy) for achieving this?
Or are you referring to hitting all the URLs manually to force Apache to cache them before users end start using the proxy.

Also how can I check for local files and conditionally proxy to the backend?

Is there no way to specify caching by file extension/regex pattern? I am only able to mark specific folders for caching as of now. If a folder has mixed content, static and dynamic files, I am not able to mark only static files for caching.
I am working with a 3rd party backend application, for which source code is not available, so I can't set the proper caching headers from the backend application.

BTW, the %R gave me the exact detail on caching in the log that I was looking for. Thanks a lot for that :)

Regards,
Sudip

-----Original Message-----
From: Tom Evans [mailto:tevans.uk@xxxxxxxxxxxxxx] 
Sent: Wednesday, September 12, 2012 7:06 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  Questions on Apache Caching

On Wed, Sep 12, 2012 at 1:15 PM, Bhattacharya, Sudip <sudip.bhattacharya@xxxxxxxxxxx> wrote:
> I am using mod_cache module to enable caching of certain subfolders in VirtualHost section which is mapped to proxy requests to a remote server.
>
> Is there any way to log requests specific to cached files? I want to know:
> 1. Which files are actually getting cached 2. How many requests are 
> actually getting served from local cache. Effectively how much bandwidth I am saving by serving files from local cache.
> 3. Is it possible to avoid the default folder structure of the caching, and get a mirror structure instead of the remote path/folder/file structure instead?
> 4. Is it possible to enable caching for specific file extensions, or 
> by MIME type
>

In 2.2 you can alter the access log to output the handler that handled the request (the format for this is %R) - when an item is returned from the cache the handler will be empty.

In 2.4 you can add set "CacheHeader on", and each response will have a "X-Cache" header added to it that says whether it was a hit or not, which can then be logged.

You cannot alter the cache file structure in that manner. However, if you can synchronise all these files from the backend to the cache, you could then only proxy to the backend if the file is not present on the frontend. This would require manual synchronisation of files on both sides.

Whether a resource is stored in the cache or not depends upon the headers that the response has. See the section labelled "What Can be Cached" here:

http://httpd.apache.org/docs/2.2/caching.html

If you don't want a particular resource to be cached, or vice-versa, set appropriate response headers. "Cache-Control: private" would allow the client receiving the resource to cache it, but not your apache cache, nor any intermediate cache between there and the client.

Cheers

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately 
by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux