Apache Disk Cache Function Sanity Test

Apache disk cache is useful for static files performance, while sometimes, the configuration of cache does not take effect. hence it is needed to validate if it is working.

Upgrade apache to latest release can solve this problem. 2.4.53 is the latest version when I write this.

For check if it is working.

First, let us check the configuration settings.

ensure two modules are loaded at httpd.conf

LoadModule cache_module modules/mod_cache.so
LoadModule cache_disk_module modules/mod_cache_disk.so

at 3DSwym_httpd_fragment.conf you can find.


CacheStorePrivate On
CacheIgnoreHeaders Set-Cookie X-SWYM X-DS-SWYM-CSRFTOKEN

CacheRoot "/tmp/DassaultSystemes/3DSwym/cache/httpd"
CacheEnable disk /

CacheDirLevels 2
CacheDirLength 2

So if your all your services use same domain , then it works for all the services, because "CacheEnable disk /" is monitoring all the url "/" including 3DSpace, otherwise you need to define your own  config at some place.

Then below is the ways to check if disk cache is working.

Add  %{cache-status}e to your log format of your VirtualHost, below is an example.

LogFormat "%h %v:%{local}p %l %u %{SSL_PROTOCOL}x %{SSL_CIPHER}x %t %{ms}T \\"%r\\" %>s %b %{cache-status}e" 3deformat

CustomLog "|/usr/DassaultSystemes/apache/bin/rotatelogs logs/3de_access-%Y-%m-%d.log 86400" 3deformat

1. Clear browser cache, access 3dspace.

2. Check apache access log, in the end of line , you find "cache hit" or other status.

"cache hit" means apache cache is working.

Another way is to check the disk cache files.

1. Clear browser cache, access 3DSpace.

2. Go to CacheRoot, here it is /tmp/DassaultSystemes/3DSwym/cache/httpd

ls -altrh

You can find the files created when accessing the 3DSpace.

This means disk cache working also.