Performance enhancements through caching

The Business Rule Beans (BRBeans) framework incorporates a cache on the client side; that is, wherever the trigger() method on the TriggerPoint object is called. This cache is scoped to the Java virtual machine (JVM) in which the client is running so that any trigger calls performed in a particular JVM use the same cache and two triggers performed in different JVMs use two different caches. The BRBeans cache caches the results of all of the queries performed to find a set of rules to be triggered. The next time a trigger is performed in that JVM with the same rules specified, the rules are found in the cache and the query does not require server processing.

Once the rules are found in the cache they are triggered, either locally or remotely, depending on how they were defined. If a rule found in the cache is specified to be triggered locally, then the entire trigger process for that rule is performed on the client without calling the server. Even if the rule is specified to be triggered remotely, finding the rule in the cache eliminates one call to the server since the query is not performed on the server.

The BRBeans cache can improve performance greatly, however it has one disadvantage: changes made to rules are not recognized immediately.

When a change is made to a rule on the server, there is no way to inform all of the potential clients that something has changed and that they may need to refresh their caches. Thus, the client cache must check periodically to see if anything in the persistent rule data has changed. This is implemented by associating a polling frequency with the cache. This polling frequency specifies an interval of time that the cache waits before checking to see if anything has changed. The next time a trigger is performed after a polling interval has passed, the cache checks to see if any changes have been made to the persistent rule data stored on the server. If no changes have been made, then the cache is not refreshed. If any changes have been made, the entire cache is cleared so that the changes are picked up. Thus, changes to the rules are only picked up by the cache after a polling interval has passed.

The default polling frequency is 10 minutes. The user can change this value by changing the single initialization parameter specified for the special rule named com/ibm/websphere/brb/BRB CacheRule. The value for this initialization parameter is in the following format: hh:mm:ss

hh stands for hours, mm stands for minutes, and ss stands for seconds.

Thus the default of 10 minutes is specified by a value of 00:10:00. To specify a polling frequency of, for example, 1 hour, 30 minutes, specify 01:30:00

When this value is changed, it does not take effect until the previous polling interval has passed. Thus, if the previous polling interval is set to 24 hours and the polling frequency is changed to 1 hour, the new frequency does not take effect until the previous 24 hour polling interval passes. The only other ways to get the new frequency to take effect are to either restart the client (since this causes the cache to be re-initialized from scratch) or have the client code call the refreshCache() method on the TriggerPoint object. If there is more than one client JVM performing triggers, this must be done for each client since each JVM has its own cache.

Note: There is only one BRB CacheRule and this rule applies to all clients. There is no way to set different polling frequencies for different clients.

Caching can be disabled for a particular TriggerPoint object using the disableCaching() method. After the disableCaching() method is called any triggers performed using that TriggerPoint object can not use the cache. Triggers performed using other TriggerPoint objects are not affected.


Related concepts
BRBeans performance enhancements
Performance enhancements using indexes
Performance enhancements by changing the firing location



Searchable topic ID:   cbrb_cache
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/brb/concepts/cbrb_cache.html

Library | Support | Terms of Use | Feedback