Another performance question

All,

Another performance question: internal data groups vs. an array within the iRule. It seems that the array would be faster. VERY small data set. I understand management of the data set itself is probably easier as a data group. However, speed is the main concern.

Cheers!

Data groups shouldn’t give you any performance problems. We have a data group that contains thousands of entries and it’s checked by an iRule over 100 times per second during peak hours and we have no problems whatsoever. CPU utilization is under 20%. Hardware is a 6900.

If you are going to be adding or removing entries on a regular basis, data group is the way to go.

If you’re curious about exact performance numbers, you can test it yourself using the timing command:

iRules Optimization 101 - 05 - Evaluating iRule Performance

Array test:

when RULE_INIT {
    array set static::uris {
        foo bar
        test blah
        this that
        ricky lucy
        fred ethel
    }
}
when HTTP_REQUEST timing on {
    log local0. $static::uris([URI::query [HTTP::uri] test])
}

Data group test:

ltm data-group internal test-dg-2 {
    records {
        foo {
            data bar
        }
        fred {
            data ethel
        }
        ricky {
            data lucy
        }
        test {
            data blah
        }
        this {
            data that
        }
    }
    type string
}

when HTTP_REQUEST timing on {
    log local0. [class match -value [URI::query [HTTP::uri] test] equals test-dg-2]
}

Displaying statistics:

tmsh show /ltm rule my-test-rule