Forum Discussion

atomicdog_7107's avatar
atomicdog_7107
Icon for Nimbostratus rankNimbostratus
May 04, 2015

chunking causing latency in iRule?

Hey guys, I have an iRule I'm testing that is inspecting some xml for a missing field and making a pool decision based on that. It is causing some latency when I apply it... 2 seconds when it is applied vs ~10ms without it. I couldn't find any issues with the logic in the iRule (except the fact that it seems to work with HTTP::collect length set to any setting which I find odd... notice below I drilled it all the way down to '1' and it still works?!). Anyway, I'm using curl and doing a POST as a test and I decided to try http 1.0 out of curiosity to see if maybe chunking was causing the latency issue. The response is almost immediate response with http 1.0. Does it sound right that chunking would add that much latency for iRule processing? I know it has to store the chunked data and wait to process it but 2 seconds seems like a really long time for it to do that (at least to me).

I've tried this on 10.2.4 and 11.6.0 with the same results. Thanks for the help in advance. Here's the iRule:

when HTTP_REQUEST {
    if { [HTTP::method] eq "POST" }{
        HTTP::collect 1
    }
}

when HTTP_REQUEST_DATA {
    if { [HTTP::payload] contains "" }
        {
        pool Pool_1
        log local0.info "Serial Number is Missing. Client IP = [IP::client_addr]"
} else {
        pool Pool_2
        }
}
  • BinaryCanary_19's avatar
    BinaryCanary_19
    Historic F5 Account
    Could you add a "log local0. "payload collected" to the top of your HTTP_REQUEST_DATA to see how many times the event is firing for a single requests?
  • aFanen01 - I added the logging before the if statement in HTTP_REQUEST_DATA... it only fires once per request. The more testing I'm doing the delay definitely does seem to be related to http chunking... it's so much faster if I specify http1.0. I just can't figure out why it's causing such a significant delay with http1.1.
  • BinaryCanary_19's avatar
    BinaryCanary_19
    Historic F5 Account
    I thought chunking on requests is quite rare, so that's strange. Usually POSTs tend to use multipart encoding, which is similar to but not the same as chunking, and in that case using HTTP 1.0 or 1.1 shouldn't make a difference. It's difficult to guess what's going on without seeing the packet captures. Is there by any chance a content-length used in HTTP 1.0 and not HTTP 1.1?