With every need arises a solution. From some customers, there came a need to simplify the evaluation of the compound expressions which iterates a particular large set of data types, making the expressions pretty long, leading to evaluation of many sub-expressions within just a single compound expression. Such complex expression evaluation leads to considerable amount of resource consumption in terms of processing cycles, memory and configuration size. To overcome this, a concept called Pattern Set was introduced.
Let’s consider a scenario to understand this better, where the NetScaler needs to process the below mentioned request and evaluate via the compound expression.
The Compound Expressions checks for multiple conditions which are created by connecting to one or more expressions (sub-expression) using the logical operators && and ||.
With the above compound expression, NetScaler will have to iterate through the entire compound expression sequentially from one sub-expression to the other, to know that the request refers to a “jpg” image.
Above is how the flow of evaluation process happens when a compound expression is evaluated. It starts with evaluating the incoming HTTP requests URLs suffix for the first sub-expression to check if it is svg image-type or not, if not, it goes to the next sub-expression and checks if the request refers to a bmp image-type. This goes on till the last sub-expression of the compound expression. This process becomes undesirable when we have hundreds of sub-expressions in just one compound expression.
Now, to counter this, we introduced the concept of Pattern Set. A pattern set is an array of indexed patterns used for string matching during default syntax policy evaluation.
During the Policy evaluation as shown above under Pattern Set method, the operator compares the string that is identified in the request with the patterns defined in the pattern set until a match is found. CONTAINS_ANY method used in this example works with only Pattern sets and returns a Boolean value that indicates whether or not a matching pattern was found.
With this “Sample_Patset” expression the extra load of multiple iteration of 6 sub-expressions within a compound expression, to know if the URL contains a jpg image got reduced down to just the iteration of one expression with the Pattern set list.
With this we eliminate the need to configure compound expressions that perform string matching with multiple OR operations. This simplifies configuration and accelerates processing of request/response through NetScaler.