ShowTable of Contents
Introduction
When rules are created to retrieve IBM® Web Content Manager (WCM) content from the repository, some of the rules can get rather complex and expensive. New in IBM WebSphere® Portal version 7 is the ability to use the Include Only option when creating a Personalization (PZN) rule to select content.
This functionality allows the system to further filter the results that are returned from one rule based on the selection criteria from a second rule. To see the best results, the first selection rule should be simple, and then the secondary rules that filter the results can be more complex.
As an example (which will be used below as the actual sample rules), let's say you want to pull all WCM content from a specific site area. Also, that content should use a specific authoring template, and be categorized within a specific category. In the old one-selection-rule approach, that process can generate an expensive query to retrieve the date from the underlying Java
TM Content Repository (JCR). However, if we split the selection criteria into two rules, we can change the query to retrieve the data from the underlying JCR repository into something much simpler. Then, the second rule is used to filter the resulting data in memory, which means a much faster end user experience.
Sample rules
In this example, we use a PZN rule to retrieve WCM content based on its location, authoring template, and a specific category. When using the Include Only option, since the second rule will filter the results of the first, you want the first rule to be simple, and the second rule to be more complicated.
1) The functionality written as one rule is shown in figure 1, with the results shown in figure 2.
Figure 1. Functionality as one rule
Figure 2. Results of the rule
2) Now create the second rule to filter the results. In this case, we want the rule to filter based on authoring template and categories. Figure 3 shows my sample rule, which selects content associated with a category CatA, and the authoring template web content/Article.
Figure 3. Rule with filter based in authoring template and categories
3) Create the first rule to select the content based on a site area, as shown in figure 4.
Figure 4. Rule to select content based on a site area
4) When we preview the rule, we see the results in figure 5.
Figure 5. Preview of rule
Performance implications
There are several reasons why this PZN functionality should be leveraged, one of which is:
- When PZN caching is used, the broader results from the first rule will be cached. This means that if, for example, the rule retrieves only content based on its location and then filters out based on a specific user's categories, the first rule's results will be cached. So, if three different users all have three different categories, then they can all leverage the same cache for the rule.
Let's now look at some real-world numbers in terms of rule performance.
Specific performance improvements
In the example rule above, one rule was used to populate all the selection criteria (see figure 6).
Figure 6. One rule to populate all selection criteria
Figure 7 is the SplitSecond output showing the timing from previewing the rule in the PZN UI. Basically, it shows that the rule execution took approximately 15 seconds. Note that, when previewing, all caches are bypassed.
Figure 7. SplitSecond output for first rule
Now, in figure 8 we see the SplitSecond output showing the timing from the rule when running the split rule. Note that the SplitSecond configuration was actually modified to show a lower threshold, since the performance was improved enough that it dropped below the threshold for SplitSecond. We can see that the same method call takes instead 1.8 seconds, which is a relatively large improvement from the first rule to the second.
Figure 8. SplitSecond output for second rule
Conclusion
This article has demonstrated how you can use the Include Only option in Personalization rules and how you can take advantage of the improved performance when using the functionality vs. not using it.
Tell us what you think
Please visit this link to take a one-question survey about this article:
http://www.surveymonkey.com/s/9Q6ZKGNResources
WebSphere Portal wiki article, "Integrating personalization rules within Web Content Management content":
http://www-10.lotus.com/ldd/portalwiki.nsf/dx/integrating-personalization-rules-within-web-content-management-content
developerWorks IBM Web Content Manager product page:
http://www.ibm.com/developerworks/lotus/products/webcontentmanager/
developerWorks IBM WebSphere Portal zone:
http://www.ibm.com/developerworks/websphere/zones/portal/