Presentation is loading. Please wait.

Presentation is loading. Please wait.

SoA Research, China Research Lab © 2005 IBM Corporation 2005-5-19 Message Oriented Middleware (MOM) Cache Pattern Fang Yan Rao, Ru Fang, Zhong Tian IBM.

Similar presentations


Presentation on theme: "SoA Research, China Research Lab © 2005 IBM Corporation 2005-5-19 Message Oriented Middleware (MOM) Cache Pattern Fang Yan Rao, Ru Fang, Zhong Tian IBM."— Presentation transcript:

1 SoA Research, China Research Lab © 2005 IBM Corporation 2005-5-19 Message Oriented Middleware (MOM) Cache Pattern Fang Yan Rao, Ru Fang, Zhong Tian IBM China Research Lab {raofy,fangru,tianz}@cn.ibm.com Harini Srinivasan, Eoin Lane, Lei He,Tim Banks IBM Software Group {harini, eoinlane}@us.ibm.com heleihl@cn.ibm.com tim_banks@uk.ibm.com

2 SoA Research, China Research Lab © 2005 IBM Corporation Motivation In a Service Oriented Architecture (SOA) environment, when the communication channel between service provider and consumer is Message Oriented Middleware (MOM), how to accelerate service response time is the problem the MOM cache pattern is targeting to solve.

3 SoA Research, China Research Lab © 2005 IBM Corporation Background of Cache Cache is a collection of Cache Item –Cache Item is (key, data) pairs –Data is identified by its key in Cache –A cache has a basic method Object hitCache(Object key) to retrieve data from cache according to its key, and refresh cache if it is missed according to certain cache refreshing policy Use existing cache solutions –Websphere DynaCache –JBossCache –SpiritCache –JCache

4 SoA Research, China Research Lab © 2005 IBM Corporation Pattern at Architectural Level - Alternatives of Cache Design Service Consumer Service Provider Cache Service Consumer Service Provider Cache Service Consumer Service Provider Server Side CacheClient Side CacheMOM Cache Cache Our Focus

5 SoA Research, China Research Lab © 2005 IBM Corporation Message Exchange Between Service Provider and Service Consumer in MOM In MOM, the request message and response message are delivered independently. And processors of request and response message also work independently and asynchronously. Service ConsumerService Provider Mediation of Message Routed to Service Provider Request Message Mediation of Message Routed to Service Consumer Response Message … … Response Message Request Message

6 SoA Research, China Research Lab © 2005 IBM Corporation Cache Mediation Shorten service response time by caching service response message correlated with request message in MOM. When identical request message is issued, message system retrieve correlated response message from cache and return the message directly to service consumer, instead of forwarding the request message to service provider. By doing so minimize costly remote service invocation and improve service response time. Figure revised from: Enterprise Service Bus – Making SOA Real, Beth Hutchison, Peter Lambros, Rob Phippen, Marc-Thomas Schmidt Request Message Cached Response Message Mediation w/ Cache

7 SoA Research, China Research Lab © 2005 IBM Corporation Challenge 1: Identify Request and Response Cache needs to identify the request and corresponding response to accelerate service responsiveness. Neither request mediation nor response mediation can identify request message and its corresponding response message in the same invocation of the hitCache method like illustrated in the sample code. Assuming MOM cache provides message correlating mechanism, how to design add cache to request mediation and response mediation, and they can collaboratively identify request and corresponding response messages?

8 SoA Research, China Research Lab © 2005 IBM Corporation Pattern Structure – Two Cache Mediations Coupled by One Cache Service ProviderService Consumer Cache Mediation of Messages Routed to Service Provider Cache Mediation of Messages Routed to Service Consumer Cache Ordinary Message Flow Accelerated Message Flow 1 2 3 4 b a Participants: Cache mediation of request message Cache mediation of response message Cache shared between both mediations Asynchronous Messaging System

9 SoA Research, China Research Lab © 2005 IBM Corporation Collaboration Between Cache Mediations

10 SoA Research, China Research Lab © 2005 IBM Corporation Cache Contents Cache entry = (cache key, cache item) Major cache entry –Cache key is composed from: User defined cache key –Example >Hash code of (request message destination, service operation, service operation parameter) Message identification method provided by messaging middleware –Cache item is composed from: Response message Supportive cache entry –(message ID, cache key)

11 SoA Research, China Research Lab © 2005 IBM Corporation Applicability Communication channel –Communication channel between service provider and consumer is messaging. Cache location –Message mediation in messaging middleware. Cache on other places like EBJ container is not applicable. Invocation style –Invoke and response, where one response message is generated according to one request. Other invocation style like pub-sub is not applicable to this pattern. Service provider side tolerance –The service to be accelerated can tolerate identical request is not delivered to it and response is cached by messaging middleware. This requires Service is not transactional Data change frequency is not high, or data expiration time is not short Data auditing policy allows request data not arrive at service provider Data privacy policy allows data cached in communication channel

12 SoA Research, China Research Lab © 2005 IBM Corporation Consequences Behavior –Behavior of messaging middleware is changed. It actively changes the routing path of request message and sends cached response message back to service consumer. –Service provider will not receive every request messages. Data –With cache in messaging middleware, response message may not be up to date. The data staleness cache brought needs to be understood by cache users, and can be alleviated by cache data refreshing policy. Performance –It increases the responsiveness of service by caching request and correlated response message. However, cache has its related cost. Message mediations need extra cost to access payload of messages and store cached messages.

13 SoA Research, China Research Lab © 2005 IBM Corporation Dependency Message Correlation –Messaging middleware needs to provide message correlation mechanism to correlate request and corresponding response messages –Correlation can be either automatically done by messaging middleware, or by service provider with correlation APIs provided by underlying messaging system. Message identification –Message middleware can provide faster message identification options so that pattern users can choose appropriate message identification for cache item identification key generation and comparison.

14 SoA Research, China Research Lab © 2005 IBM Corporation Implementation Based On WebSphere Application Server (WAS) v 6 WAS v 6 has platform messaging to provide asynchronous messaging capability. On top of it WAS v 6 has SIBus to support message-based and service-oriented architectures. Implementation of cache mediation is cache mediation handler EJBs deployed on WAS, together with a set of configurations of SIBus. Built on top of DistributedMap cache provided in WAS.

15 SoA Research, China Research Lab © 2005 IBM Corporation Pattern Codified in Rational Software Architect RSA has pattern authoring and application capability to codify the pattern. Apply the pattern to UML model in RSA, and the pattern can automatically generate code and deployment script for cache mediations

16 SoA Research, China Research Lab © 2005 IBM Corporation Demo of Pattern Application UML to UML Transformation to Generate Deployment Model Apply Pattern UML to Java Transformation to Generate Runtime Artifact

17 SoA Research, China Research Lab © 2005 IBM Corporation Runtime Screenshot of Weather Forecast Demo RequestCacheMediationHandler didnt find the cache key and insert a new cache entry with empty response message in cache item. ResponseCacheMedia tionHandler find the cache key and update the cache item with a new response message.

18 SoA Research, China Research Lab © 2005 IBM Corporation Second invoking the web service with the same request parameter (Day of Number = 3) RequestCacheMediati onHandler get response message from cache and return to service consumer. ResponseCacheMediat ionHandler neednt update cache item Runtime Screenshot of Weather Forecast Demo (cont.)

19 SoA Research, China Research Lab © 2005 IBM Corporation Challenge 2: Uniform Underlying Cache API For Websphere DynaCache –class com.ibm.websphere.cache.DistributedMap implements java.util.Map –Has get and add method derived from java.util.Map For other Caches, provide different APIs How to hide APIs differences so that when different cache implementations provide different APIs, the cache user neednt change its code?

20 SoA Research, China Research Lab © 2005 IBM Corporation Candidate Solution – Factory Method


Download ppt "SoA Research, China Research Lab © 2005 IBM Corporation 2005-5-19 Message Oriented Middleware (MOM) Cache Pattern Fang Yan Rao, Ru Fang, Zhong Tian IBM."

Similar presentations


Ads by Google