1 / 20

Message Oriented Middleware (MOM) Cache Pattern

Message Oriented Middleware (MOM) Cache Pattern. 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. Fang Yan Rao, Ru Fang, Zhong Tian IBM China Research Lab {raofy,fangru,tianz}@cn.ibm.com. Motivation.

misha
Télécharger la présentation

Message Oriented Middleware (MOM) Cache Pattern

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Message Oriented Middleware (MOM) Cache Pattern 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 Fang Yan Rao, Ru Fang, Zhong Tian IBM China Research Lab {raofy,fangru,tianz}@cn.ibm.com

  2. 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. 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. Pattern at Architectural Level - Alternatives of Cache Design Service Provider Service Provider Service Provider Cache Cache Cache Service Consumer Service Consumer Service Consumer Server Side Cache Client Side Cache MOM Cache Our Focus

  5. 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 Consumer Mediation of Message Routed to Service Provider Mediation of Message Routed to Service Consumer Service Provider Request Message … Request Message Response Message … Response Message

  6. 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. Mediation w/ Cache Request Message Cached Response Message Figure revised from: Enterprise Service Bus – Making SOA Real, Beth Hutchison, Peter Lambros, Rob Phippen, Marc-Thomas Schmidt

  7. 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. Pattern Structure – Two Cache Mediations Coupled by One Cache Asynchronous Messaging System Cache Mediation of Messages Routed to Service Provider 2 1 a b Service Consumer Service Provider Cache 3 4 Cache Mediation of Messages Routed to Service Consumer • Participants: • Cache mediation of request message • Cache mediation of response message • Cache shared between both mediations Ordinary Message Flow Accelerated Message Flow

  9. Collaboration Between Cache Mediations

  10. 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. 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. 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. 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. 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. 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. Demo of Pattern Application Apply Pattern UML to UML Transformation to Generate Deployment Model UML to Java Transformation to Generate Runtime Artifact

  17. RequestCacheMediationHandler didn’t find the cache key and insert a new cache entrywith empty response message in cache item. Runtime Screenshot of Weather Forecast Demo ResponseCacheMediationHandler find the cache key and update the cache item with a new response message.

  18. Runtime Screenshot of Weather Forecast Demo (cont.) Second invoking the web service with the same request parameter (Day of Number = 3) RequestCacheMediationHandler get response message from cache and return to service consumer. ResponseCacheMediationHandler needn’t update cache item

  19. 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 needn’t change its code?

  20. Candidate Solution – Factory Method

More Related