You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Andrew Dixon <an...@andrewdixon.co.uk> on 2008/11/03 13:19:11 UTC

[users@httpd] mod_cache and mod_mem_cache

Hi All,

I have enabled mod_cache and I'm using mem caching (mod_mem_cache) as my
caching type, but how can I check if it is actually doing anything. Is there
anyway to see what is in the cache, being served from the cache, what the
cache hit rate is, etc...???

Thanks

Kind regards,

Andrew.

Re: [users@httpd] mod_cache and mod_mem_cache

Posted by Manik Taneja <mt...@movik.net>.
Hi,

This requires some amount of development work. We added an additional 
header to the response header, X-Cache-Stat.  In file mod_cache.c, the 
following changes were made. The actual line numbers may differ 
depending on your version of the code.


465a477,480
 >         /*mbenjamin: TCP_MISS*/
 >         if (!apr_table_get(r->headers_out, "X-CacheStat"))
 >             apr_table_setn(r->headers_out, "X-CacheStat", 
"TCP_MISS_VERIFY");
 >
492a508,511
 >         /*mbenjamin: TCP_MISS*/
 >         if (!apr_table_get(r->headers_out, "X-CacheStat"))
 >             apr_table_setn(r->headers_out, "X-CacheStat", 
"TCP_MISS_NOSTORE");
 >
503c522,526
<     }
---
 >             /*mbenjamin: TCP_MISS*/
 >         if (!apr_table_get(r->headers_out, "X-CacheStat"))
 >             apr_table_setn(r->headers_out, "X-CacheStat", 
"TCP_MISS_PRIVATE");
 >
 > }
514a538,541
 >         /*mbenjamin: TCP_MISS*/
 >         if (!apr_table_get(r->headers_out, "X-CacheStat"))
 >             apr_table_setn(r->headers_out, "X-CacheStat", 
"TCP_MISS_AUTH_FAILED");
 >
530a558,560
 >         /*mbenjamin: TCP_MISS*/
 >         if (!apr_table_get(r->headers_out, "X-CacheStat"))
 >             apr_table_setn(r->headers_out, "X-CacheStat", "TCP_MISS");
606a637
 >
607a639,647
 >             /*mbenjamin: TCP_HIT_VERIFY*/
 >             if(!apr_table_get(r->headers_out, "X-CacheStat")) {
 >             if(strstr("mem", cache->provider_name)) {
 >                        apr_table_setn(r->headers_out, "X-CacheStat", 
"TCP_HIT_VERIFY_MEM");
 >             }else{
 >                        apr_table_setn(r->headers_out, "X-CacheStat", 
"TCP_HIT_VERIFY_DISK");
 >                     }
 >                 }
 >
621a662,664
 >             /*mbenjamin: TCP_MISS_VERIFY*/
 >             apr_table_setn(r->headers_out, "X-CacheStat", 
"TCP_MISS_VERIFY");
 >
629a673,677
 >
 >         /*mbenjamin: TCP_MISS*/
 >     if (!apr_table_get(r->headers_out, "X-CacheStat"))
 >             apr_table_setn(r->headers_out, "X-CacheStat", "TCP_MISS");
 >

Then as a final step you configure the access log format in httpd.conf 
to log the value of the X-CacheStat header.

hope this helps.

Thanks,
Manik

Andrew Dixon wrote:
> Hi Manik,
>
> Can you explain how you did this?
>
> Thanks
>
> Andrew
>
> 2008/11/5 Manik Taneja <mtaneja@movik.net <ma...@movik.net>>
>
>     Andrew Dixon wrote:
>
>         Hi All,
>
>         I have enabled mod_cache and I'm using mem caching
>         (mod_mem_cache) as my caching type, but how can I check if it
>         is actually doing anything. Is there anyway to see what is in
>         the cache, being served from the cache, what the cache hit
>         rate is, etc...???
>
>     There isn't a way, at least as of apache 2.2.9. <http://2.2.9.> We
>     had a similar problem but i modified the status code that gets
>     logged to apache logs to indicate is the 200OK/302 was a result of
>     a cache-hit.
>     -M
>
>         Thanks
>
>         Kind regards,
>
>         Andrew.
>
>
>
>     ---------------------------------------------------------------------
>     The official User-To-User support forum of the Apache HTTP Server
>     Project.
>     See <URL:http://httpd.apache.org/userslist.html> for more info.
>     To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>     <ma...@httpd.apache.org>
>      "   from the digest: users-digest-unsubscribe@httpd.apache.org
>     <ma...@httpd.apache.org>
>     For additional commands, e-mail: users-help@httpd.apache.org
>     <ma...@httpd.apache.org>
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_cache and mod_mem_cache

Posted by Andrew Dixon <an...@andrewdixon.co.uk>.
Hi Manik,
Can you explain how you did this?

Thanks

Andrew

2008/11/5 Manik Taneja <mt...@movik.net>

> Andrew Dixon wrote:
>
>> Hi All,
>>
>> I have enabled mod_cache and I'm using mem caching (mod_mem_cache) as my
>> caching type, but how can I check if it is actually doing anything. Is there
>> anyway to see what is in the cache, being served from the cache, what the
>> cache hit rate is, etc...???
>>
>>  There isn't a way, at least as of apache 2.2.9. We had a similar problem
> but i modified the status code that gets logged to apache logs to indicate
> is the 200OK/302 was a result of a cache-hit.
> -M
>
>  Thanks
>>
>> Kind regards,
>>
>> Andrew.
>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] mod_cache and mod_mem_cache

Posted by Manik Taneja <mt...@movik.net>.
Andrew Dixon wrote:
> Hi All,
>
> I have enabled mod_cache and I'm using mem caching (mod_mem_cache) as 
> my caching type, but how can I check if it is actually doing anything. 
> Is there anyway to see what is in the cache, being served from the 
> cache, what the cache hit rate is, etc...???
>
There isn't a way, at least as of apache 2.2.9. We had a similar problem 
but i modified the status code that gets logged to apache logs to 
indicate is the 200OK/302 was a result of a cache-hit.
-M

> Thanks
>
> Kind regards,
>
> Andrew.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org