Forum Discussion

Marvin_129795's avatar
Marvin_129795
Icon for Nimbostratus rankNimbostratus
Sep 04, 2015

Webacceleration profile not caching

Dear All,

 

I have a Big IP LTM ASM provisioned and applied a web accelerator profile with the default settings (version 11.5.1) to a virtual server. A lot of traffic is passing through but I simply do not see any traffic being cached inside the Ramcache. Also I analyzed the traffic and the HTTP reply packets don’t contain the new age header value.

 

In the webacceleration profile counters I notice a lot of misses, but when I analyze the traffic in Wireshark I see a lot of objects like css, png, jpg, json, js that I believe is all cacheable. Also what I would like to achieve is to alter the cache timer for all objects passing through F5 towards the clients by inserting the new age header.

 

In some objects I notice Cache Control: private, must revalidate, max age=0 but most of the objects responses don’t have any caching header at all. All the objects have the response code 200, so that is also not the issue here.

 

Test results show that the age header is never altered as configured in the webaccelerator profile. As I said before the profile is very basic configured with no filter, Ignore Headers All (also tried none), insert age header enabled, aging rate = 9. I have never seen anything in the cache and the caching time is 100 days.

 

I would like to know why none of these objects are cacheable and why is F5 not changing the age time (cache expiration date)? Perhaps there is something that needs to be configured within the application itself to be cacheable?

 

I hope someone has the answer over here.

 

  • Marvin's avatar
    Marvin
    Icon for Cirrocumulus rankCirrocumulus

    Hi Patrick,

     

    I tried your Irule but it did not change anything, there was still nothing being cached. I was testing a bit more to find out what can be causing this strange behavior and you would be amazed on what I found. In the LTM policy that I applied to the virtual server I have some controls activated like ASM, http and l7dos. When I disabled the ASM function in the LTM policy rule that specific content started to be cached in the RamCache immediately.

     

    So the doubt I had was correct it is ASM preventing the objects to be cached in RamCache. Just started to look for known issues and found the following article

     

    sol14880: BIG-IP ASM may prevent object caching

     

    https://support.f5.com/kb/en-us/solutions/public/14000/800/sol14880

     

    It just happened to be that I have the policy builder running and ASM is still not in blocking mode. Recommendation When enabling caching on the BIG-IP ASM system, you should apply the Web Acceleration profile or RAM Cache to the BIG-IP ASM-enabled virtual server only after the BIG-IP ASM security policy is stable and in blocking mode.

     

  • Hi Marvin!

    I've seen this before and the answer is usually to use iRules. If I don't remember wrongly the F5 does not cache certain items unless you specifically asks it to.

    Try this simple iRule and replace cacheditem.aspx with whatever selector you want.

    when HTTP_REQUEST {
    
        set uri [string tolower [HTTP::uri]]
    
        if { $uri equals "/cacheditem.aspx" } {
            CACHE::enable
            CACHE::uri $uri
        }
    }
    
    when CACHE_RESPONSE {
           CACHE::header insert X-CacheStatus "Hit"
           CACHE::header insert X-CacheAge [CACHE::age]
    }
    

    With this rule you can see if your request has been cached in the response headers. You can also use starts_with instead of equals. Take care though so you don't cache something you did not want to cache.

    One more advise is to use a small cache size to begin with as the F5's memory allocation does not seem to be included in the cache size. This means that if you allocate too small objects and too many of them you could potentially run out of memory. Saw this once on our Viprions.

    Hope this helps!

    /Patrik

  • Marvin's avatar
    Marvin
    Icon for Cirrocumulus rankCirrocumulus

    Important thing to note is that I do see something in the cache but only one object named favicon.ico (saw that thing earlier but is not really used by the application). Also the the expiry date is correct in the Ramcache. When I see the reply of the HTTP request for /favicon.ico its a 200 OK, but I still dont see an age header or any cache control in the HTTP header in the response packet to the client. THe only difference between this object and all the other objects passing through is that this object is not being inspected by ASM or DDOS. Maybe that is causing the problem.

     

    URI : /favicon.ico

    Source Slot/TMM 1/1 Owner Slot/TMM 1/1 Rank 1

     

    Size (bytes) 1402 Hits 0 Received 2015-09-07 16:26:28 Last Sent 2015-09-07 16:26:28 Expires 2015-12-16 16:26:28 Vary Type none Vary Count 1 Vary User Agent none Vary Encoding none Total records returned: 1

     

  • Marvin's avatar
    Marvin
    Icon for Cirrocumulus rankCirrocumulus

    Hi Patrick,

     

    I actually tried both profiles als changed ignore headers to All or None without any result. Maybe it has to do with the cache-control header not being difined by the web server. There is a good article over here with more details. Also the clients browser has to request for it seems to be, but I am not sure.

     

    https://devcenter.heroku.com/articles/increasing-application-performance-with-http-cache-headers

     

    ltm profile web-acceleration /Common/optimized-acceleration { * app-service none * cache-aging-rate 9 * cache-client-cache-control-mode none * cache-insert-age-header enabled * cache-max-age 8640000 * cache-max-entries 10000 * cache-object-max-size 67108864 * cache-object-min-size 0 * cache-size 256mb * cache-uri-exclude none * cache-uri-include { .* } * cache-uri-include-override none * cache-uri-pinned none * defaults-from /Common/webacceleration *}

     

    ltm profile web-acceleration /Common/optimized-caching { * app-service none * cache-aging-rate 9 * cache-client-cache-control-mode none * cache-insert-age-header enabled * cache-max-age 8640000 * cache-max-entries 10000 * cache-object-max-size 10000000 * cache-object-min-size 0 * cache-size 256mb * cache-uri-exclude none * cache-uri-include { .\.pdf .\.css .\.jpg .\.js .\.gif .\.png .\.html .\.htm .\.txt } * cache-uri-include-override none * cache-uri-pinned none * defaults-from /Common/webacceleration *}

     

  • Hi Marvin

     

    Could you please post the web acceleration configuration from the config file?

     

    /Patrik