Forum Discussion

webops_97953's avatar
webops_97953
Icon for Nimbostratus rankNimbostratus
Jul 15, 2015

F5-RAMcache cache only when the cache headers is present

Hello, I trying to configure the F5 devices to enable cache only when the cache headers is present and caching the time specified in the headers. After done some test I can see the objects without cache headers in the backend are cached with randomly time-to-be-cached (I'm sure is not random but I don't know the algorithm applied) Do anybody how to configure RAMCache to only cache the object when the cache headers is present?

In all my tests the field Ignore Headers is set to "none"

I like share my lab and test, all of them test in 8950 with 10.2.4 version. http profile applied

profile http STATIC-HTTP {
   defaults from http
   ...
   ramcache enable
   ramcache size 512mb
   ramcache max entries 10000
   ramcache min object size 512
   ramcache max object size 102400
   ramcache ignore client cache control all
   ramcache aging rate 9
   ramcache insert age header enable
   ramcache uri exclude "/someobject.gif"
   ramcache uri include none
   ramcache uri pinned none
   ...
}

F5 runtime memory - tmsh show /ltm profile ramcache STATIC-HTTP

....
Host: www.domain.com
URI : /file.html
--------------------------------------
  Source Slot/TMM  0/7
  Owner Slot/TMM   0/0
  Rank             1

  Size (bytes)     274
  Hits             0
  Received         2015-07-15 06:11:04
  Last Sent        2015-07-15 06:11:04
  Expires          2015-07-15 06:39:24
  Vary Type        none
  Vary Count       1
  Vary User Agent  none
  Vary Encoding    none
Total records returned: 2

Request to F5 - 2 requests, the second one with the origin content changed

osmc@osmc:~$ curl --user-agent t7  -H"Host: www.domain.com http://1.2.3.4/file.html -IXGET
HTTP/1.1 200 OK
Date: Wed, 15 Jul 2015 06:11:04 GMT
Server: Apache
Last-Modified: Wed, 15 Jul 2015 05:56:54 GMT
ETag: "b-51ae39f32c30d"
Accept-Ranges: bytes
Content-Length: 11
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

osmc@osmc:~$ curl --user-agent t7  -H"Host: www.domain.com http://1.2.3.4/file.html -IXGET
HTTP/1.1 200 OK
Server: Apache
Last-Modified: Wed, 15 Jul 2015 05:56:54 GMT
ETag: "b-51ae39f32c30d"
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=100
Content-Type: text/html
Connection: Keep-Alive
Date: Wed, 15 Jul 2015 06:11:48 GMT
Age: 44
Content-Length: 11

Requests to backend : 2 GETs with apache in foreground and changing the content requested

 curl -IXGET -H"Host: www.domain.com" http://apacheX/file.html
HTTP/1.1 200 OK
Date: Wed, 15 Jul 2015 06:11:21 GMT
Server: Apache
Last-Modified: Wed, 15 Jul 2015 05:56:54 GMT
ETag: "b-51ae39f32c30d"
Accept-Ranges: bytes
Content-Length: 11
Content-Type: text/html

1.2.3.4 vhostX - [15/Jul/2015:08:11:37 +0200] "GET /file.html HTTP/1.1" 200 11 "-" "curl/7.19.5 (ostype) libcurl/7.19.5 OpenSSL/0.9.7d zlib/1.2.3" www.domain.com "-" "-" 1486

 date +%s > file.html && cat file.html
1436940694
 curl -IXGET -H"Host: www.domain.com" http://apacheX/file.html
HTTP/1.1 200 OK
Date: Wed, 15 Jul 2015 06:11:37 GMT
Server: Apache
Last-Modified: Wed, 15 Jul 2015 06:11:34 GMT
ETag: "b-51ae3d3a72c54"
Accept-Ranges: bytes
Content-Length: 11
Content-Type: text/html

1.2.3.4 vhostX - [15/Jul/2015:08:11:37 +0200] "GET /file.html HTTP/1.1" 200 11 "-" "curl/7.19.5 (ostype) libcurl/7.19.5 OpenSSL/0.9.7d zlib/1.2.3" www.domain.com "-" "-" 1486
No RepliesBe the first to reply