SOA patterns

2,586 views
2,398 views

Published on

Building SOAs from unreliable components

Published in: Technology
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,586
On SlideShare
0
From Embeds
0
Number of Embeds
29
Actions
Shares
0
Downloads
0
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide
  • http://www.flickr.com/photos/mikmik_uk/2867687602/sizes/o/
  • It has been quite a while since I last presented – in fact it was just a bit more than 2 years ago when I presented in Dr. Dobb’s ArchitectureI spent most of my time since buried inside xsightsI like startups (that’s my second time around) it is a cooking pot for new learnings* I’d like to give you a short glimpse into a typical day @ the office (courtesy of Tim ConleyConnelly customer expectations…http://painting-life.blogspot.com/2009/08/morning-mist.html
  • Software architecture is the collection of the fundamental decisions about a software product/solution designed to meet the project's quality attributes (i.e. requirements). The architecture includes the main components, their main attributes, and their collaboration (i.e. interactions and behavior) to meet the quality attributes. Architecture can and usually should be expressed in several levels of abstraction (depending on the project's size). If an architecture is to be intentional (rather than accidental), it should be communicated. Architecture is communicated from multiple viewpoints to cater the needs of the different stakeholders.Architectural decisions are global tied to quality attributesDesigns decisions are local –tied to functionality Photograph: Charlie Brown http://www.bestfoto.com/Galleries/GalleryView.asp?PIC=01%2D11%2Ejpg
  • Client Serverdescribes client-server components as follows: A client is a triggering process; a server is a reactive process. Clients make requests that trigger reactions from servers. Thus, a client initiates activity at times of its choosing; it often then delays until its request has been serviced. On the other hand, a server waits for requests to be made and then reacts to them. A server is usually a non-terminating process and often provides service to more than one client.LayeredThe layered style is composed of layers (the components) which provides facilities and has a specific roles. The layers have communication paths / dependencies (the connectors).In a layered style a layer has some limitations on how it can communicate with other layers (the constraints). Typically a layered is allowed to call only the layer below it and be called only by the layer above it (but there are variants e.g. a layer can call to any layer below it; etc. - all is fine as long as the layers communication paths are limited and restricted by some rules)Pipes and FiltersFilters - are independent processing steps they are constrained to be autonomous of each other and not share state, control thread etc. Pipes - are interconnecting channels“invisible hand” arranging the filters (..bpm) Brings autonomyDistributed AgentsThe term "agent" describes a software abstraction, an idea, or a concept, similar to OOP terms such as methods, functions, and objects.[citation needed] The concept of an agent provides a convenient and powerful way to describe a complex software entity that is capable of acting with a certain degree of autonomy in order to accomplish tasks on behalf of its user. But unlike objects, which are defined in terms of methods and attributes, an agent is defined in terms of its behavior.[citation needed]Various authors have proposed different definitions of agents, these commonly include concepts such aspersistence (code is not executed on demand but runs continuously and decides for itself when it should perform some activity)autonomy (agents have capabilities of task selection, prioritization, goal-directed behaviour, decision-making without human intervention)social ability (agents are able to engage other components through some sort of communication and coordination, they may collaborate on a task)reactivity (agents perceive the context in which they operate and react to it appropriately).
  • I am not going to talk about the “Code On Demand” since it is optional (also easy to understand – think javascript)
  • In addition to a solution, a pattern gives us context, forces and consequences What are the patterns we are going to look at today?Reporting & BI ( Incident analysis) (Aggregated Reporting and Inversion of Communications)Connecting legacy UI ( Client/Server/Service)Securing integration with external Party (Service Firewall, ticket server) Reliability (Transactional Service, Saga vs. Cross-service transactions)Availability (Virtual End-point, Service Instance)Flexibility ( Workflodze vs. Orchestrated Choreography vs. ?)Manageability (Blogjecting Watchdog & MPerformance (Decouples invocation vs. Request/Reply)
  • Maybe in the future Video platform/IVP replacement(maybe later) Dedicated Client
  • Set up and provide common componentse.g. throtteling and message size ,
  • Stages approachFailure detectionService instance (simple services) vs. Virtual endpoint (handle redirection within the service – more autonomous but more complex)
  • http://www.flickr.com/photos/29327368@N06/2739558370/sizes/o/What does it mean to achieve 99.999% in an SOAMTBF vs.MTBCFReliable Messaging, “transactions” - we already talked about that – will all help us more reliable when a crash happens How much time 99 % - 3d 15h 36s99.9% - 8h 45m 57s99.99% - 52m 35s99.999% - 5m 15s99.9999% - 31s The number of “9” for a single component depends on its own reliability and on the interactions it has (each call is a chance for a failure)The overall reliablity of a system is the product of the reliabilities of each component (the more component you have the lower is your systems reliability -> again beware of fine grained services)
  • Lets look at a sample process and say it has a 99% availability (about 3.5 days of downtime in a year)
  • About 31.5 days of downtime a year – each component (service) and that’s before we consider the reliability of all the network calls….
  • stratus
  • http://www.flickr.com/photos/rosendahl/2110324860/sizes/l/
  • Video calls means no client – so we need a service to handle call flowLikely to failNeed to mat
  • We can also use the Service instance pattern we already mentioned
  • The service components are simpler e.g less locks (less likely to fail)We may even redirect on failure (if we can detect it – more later)Only handle one session More management overhead (virtual end-point is simpler in that sense)Remener MTBF vs. MTCBF
  • Needs stateless components Since we do have state we’ll need stateless communications (e.g.
  • Take 1
  • The bread and butter of communication in general anRPC over SOA - a generalized antipattern of the above Simple to implement – time to market
  • Good for stateful services
  • 1. prepare an interaction (offline)2. define the coordinates for a link (offline)3. Preprocess target pages (offline)4. Accept a 3G call (using RV 3G GW)5. Initiate a call on the IVP (RV product)6. The IVP contacts a web service to accept the call configuration7. The web service contacts a resource manager to get an Address for a SIP Listner, passing it the radvision session ID 8 The Resource Manager allocates all the resources needed to handle a call (including a SIP listner) and returns the list to the webservice9 The webservice configures the conference call for the IVP sending video to the user from a cestel application and sending the incoming video to the SIP listner10 The siplisners negotiates a session with the IVP and instructs it to send the video to the RTP extractor11 The RTP extractor, listen for incoming video, using a component developed by DSP-IP it extracts individual frames from the video and forwards them to the algorithmic engine12. The algorithmic engine wrapper, accepts the frames and initiates a match 13 The algorithmic engine converts the image to grayscale , calls the matlab algorithm and returns a result to the wrapper14 the wrapper forwards the coordinates to the dispatcher15. the dispatcher looks at the list of links and identifies the relevant link16. The dispatcher updates a the web connector with the last identified link17, All this time the cestel application streams a webpage18. The webpage constantly polls the web connector for the the identified link and when that is updated by the dispatcher (step 16) updates the display to indicate the link
  • Be careful from theNanoservices Anti-pattern- make every little component a service
  • Take 1
  • “pigeon blog”: monitoring air quality by equipping GPS on pigeons (Beatriz da Costa)Beatriz da Costa showing miniaturized hardware for Pigeon Blog project at ISEA2006(http://www.flickr.com/photos/26468628@N00/74795130/in/set-1193491/)
  • Set up and provide common componentse.g. throtteling and message size ,
  • PBITCBITIBIThttp://www.flickr.com/photos/37643027@N00/2050024263/sizes/o/
  • http://www.flickr.com/photos/myklroventine/3261364899/sizes/l/
  • ODS – Operational Data Store
  • Stages approachFailure detectionService instance (simple services) vs. Virtual endpoint (handle redirection within the service – more autonomous but more complex)
  • The routing problem
  • Same resource two saga initiatorsDistributed resource allocation
  • With less guarantees Expected to fail
  • SOA patterns

    1. 1. SOA Patterns <br />© 2008 Studio MikMik<br />
    2. 2. ArnonRotem-Gal-Oz<br />
    3. 3. Another quiet day at the office…<br />© Todd Bonita 2009<br />
    4. 4. Before we begin<br />
    5. 5. SOA<br />Policy<br />Adheres to<br />governed by<br />End Point<br />Binds to<br />Exposes<br />Serves<br />Service <br />Consumer<br />Service<br />Contracts<br />implements<br />Understands<br />describes<br />Key<br />Component<br />Messages<br />Sends/Receives<br />Sends/Receives<br />Relation<br />
    6. 6. Pipes and Filters<br />Client Server<br />Distributed<br />Agents<br />Layered<br />System<br />Stateless<br />Comm.<br />SOA is derived from other styles<br />SOA<br />
    7. 7. SOA vs. REST<br />Pipes and Filters<br />Client Server<br />Uniform Interface<br />Virtual Machine<br />Distributed<br />Agents<br />Layered<br />System<br />Replicated Repository<br />Code On<br />Demand<br />Stateless<br />Comm.<br />Cacheable<br />REST<br />SOA<br />
    8. 8. SOA also means challenges…<br />
    9. 9. …and patterns can help mitigate them<br />Virtual Endpoint<br />Service Instance<br />Workflodize<br />Edge Component<br />Gridable Service<br />Blogjecting Watchdog<br />Inversion of Communications<br />Orchestrated Choreography<br />Composite Frontend<br />Transactable Service<br />Identity Provider<br />Request/Reply<br />Parallel Pipelines<br />Service Firewall<br />Decoupled Invocation<br />Saga<br />Aggregated Reporting<br />Client/Server/Service<br />Service Monitor<br />
    10. 10. Xsights, meet audienceAudience, xsights<br />
    11. 11. Mobile Integration<br />Services<br />Applications<br />Advertizing<br />Management<br />Resources<br />Reporting<br />Rich Client<br />Link management<br />Web based<br />Link Managment<br />
    12. 12. Mobile Integration<br />Services<br />3G Video Calls<br />MMS<br />Dedicated<br />Client<br />3rd parties<br />Monitoring<br />Usage Datmart<br />Ad Management<br />Applications<br />Acquisition<br />Interactions<br />branding<br />Targeted Advertizing<br />Campaign Mgmt.<br />Billing<br />Resources<br />Reporting<br />Interactions<br />Reference <br />Data<br />Links<br />Data mining & Statistics<br />Link Managment<br />Reports<br />Publishing tools integration<br />Interaction<br />Designer<br />Web<br />Front-end<br />Data Interfaces<br />
    13. 13. Load balancer<br />Smart<br />phones<br />Web Server<br />(IIS/Apache<br />Web Server<br />(IIS/Apache<br />MMS<br />Gateway<br />3G<br />Gateway<br />3G<br />Gateway<br />Camera<br />Phones<br />DMZ<br />Firewall<br />Load balancer<br />App Server<br />App Server<br />App Server<br />App Server<br />App Server<br />App Server<br />App Server<br />Operational<br />Firewall<br />Backend<br />BI & Reporting<br />Links Registeration<br />Sync.<br />Server<br />NMS<br />Paper<br />Editor<br />Web Server<br />(IIS/Apache<br />Firewall<br />Advertizing clients<br />DB<br />Links<br />Datamart<br />usage<br />DB<br />References<br />Admin<br />Console<br />DMZ<br />
    14. 14. ServiceHost<br />Edge<br />Business<br />Logic<br />WD<br />Agent<br />Resource<br />Allocator<br />Event<br />Broker<br />
    15. 15. The Service host sets up the common components and services for each Component<br />
    16. 16. Challenge – Service Availability<br />
    17. 17. What’s in a 9<br />
    18. 18. 0.99 reliability <br />We have a nice little legacy<br /> business component<br />
    19. 19. And we move it to SOA<br />
    20. 20. Failsafe hardware <br />Status Technologies<br />FT Server<br />
    21. 21. Or try to detect failure , handle it and minimize its effect on overall service<br />© Rosendahl<br />
    22. 22. What’s the effect of a failure - Server<br />Call Flow<br />Service<br />E1 line = 30 concurrent video calls<br />
    23. 23. Service Instance<br />Service Business<br />logic<br />End point<br />reaction<br />Distribute<br />Request/Reply<br />Dispatcher<br />request<br />Edge<br />Service Instance<br />
    24. 24. What’s the effect of a failure - Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />E1 line = 30 concurrent video calls<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />Call Flow<br />Channel<br />
    25. 25. Service Instance with NLB<br />Real IP : 1.1.1.2<br />Real IP : 1.1.1.3<br />Real IP : 1.1.1.4<br />Cluster Host<br />Cluster Host<br />Windows Host<br />Service <br />Service <br />Edge<br />Instance<br />Instance<br />Windows Kernel<br />Windows Kernel<br />Windows Kernel<br />TCP/IP<br />TCP/IP<br />TCP/IP<br />NLB Driver<br />NLB Driver<br />NIC Driver<br />NIC Driver<br />NIC Driver<br />NIC<br />NIC<br />NIC<br />Virtual IP : 1.1.1.1<br />
    26. 26. Alternative : Virtual Endpoint<br />
    27. 27. Challenge - Flexibility<br />
    28. 28. Request/Reply<br /> EndPoint<br />2.<br />1. Request<br />Synchronous <br />processing<br />3. Reply<br />Service<br />Service Consumer<br />
    29. 29. Things look Cool & Simple ™ <br />3G Call<br />
    30. 30. Parallel Pipelines<br />Key<br />Queue<br />SOA Component<br />Pattern Component<br />Relation<br />Concern/attribute <br />pipeline<br />pipeline<br />Edge<br />Request<br />EndPoint<br />Request 1<br />EndPoint<br />EndPoint<br />Perform <br />Task<br />Request 2<br />Perform <br />Task<br />Reaction<br />pipeline<br />EndPoint<br />Perform <br />Task<br />Service<br />
    31. 31. IVP (RV)<br />3G GW<br />(RV)<br />SIP Listner<br />3G VAS (Cestel)<br />RTP Image Extractor<br />3G Builder (Cestel)<br />WS<br />Alg. Engine<br />WebRenderer<br />Resource Manager<br />Dispatcher<br />WebConnector<br />Turn out Complicated & Ugly ™ <br />
    32. 32. Inversion of Communications<br />
    33. 33. Consumer view<br />http://www.flickr.com/photos/crimson_wolf/2851737125/sizes/l/<br />
    34. 34. Service view<br />[ServiceContract]<br />[DataContract]<br />publicclassSendMmsEvent : ImEvent<br /> {<br />///<summary><br />/// end user's number. should be in international format: +[country-code]number. Example: +491737692260<br />///</summary><br /> [DataMember]<br />publicstringToNumber { get; set; }<br />///<summary><br />/// service's number, usually a short-code. Example: 84343<br />///</summary><br /> [DataMember]<br />publicstringFromNumber { get; set; }<br />///<summary><br />/// Text, as byte array. Use Encoding classes to do it.<br />///</summary><br /> [DataMember]<br />publicbyte[] TextAsByteArray { get; set; }<br />///<summary><br />/// Image, as byte array. Can be: jpg, gif, png, bmp. (jpg rulez!!)<br />///</summary><br /> [DataMember]<br />publicbyte[] ImageAsByteArray { get; set; }<br />///<summary><br />///Remeber<c>ImageAsByteArray</c>? - This is where you manaually tell us what's the extension. Yes, we can inspect the signature, but why?<br />///</summary><br /> [DataMember]<br />publicstringImageExtension { get; set; }<br />///<summary><br />/// the mms message should have a subject. just put something there.<br />///</summary><br /> [DataMember]<br />publicstring Subject { get; set; }<br />
    35. 35. Edge translates external structures to internal ones<br />
    36. 36. Sagas tie instances together for conversations<br />
    37. 37. Call Recovery<br />X<br />
    38. 38. Alternative : Orchestration<br />Service<br />Service<br />request<br />reaction<br />Protocol<br />Manage<br />Process<br />Schedule<br />Coordinator<br />route<br />request<br />monitor<br />Workflow instance<br />Offline<br /> designer<br />Host<br />Workflows<br />Auxiliary tools<br />Workflow Engine<br />Orchestration platform<br />
    39. 39. Be Wary of Nano-Services<br />
    40. 40. Challenge - Management<br />
    41. 41. Blogjecting Watchdog<br />Edge<br />Service<br />EndPoint<br />Monitor<br />Watchdog <br />Agent<br />Watchdog <br />Edge<br />Monitor<br />Request<br />Heal<br />EndPoint<br />Reports<br />Monitor<br />Report<br />Monitor<br />Monitor<br />Log<br />
    42. 42. Blogjects concept is about collaborating objects<br />
    43. 43. RESTful resource management<br />
    44. 44. http://devrig:52141/RM/Sessions/abc/<br />ATOMPUB<br />Session details<br />URI (ID)<br />State (start/end/status etc.)<br />Resources<br />Knows status<br />URI for the Resource representation on the RM<br />URI for the Resource itself<br />
    45. 45. ServiceHost<br />Edge<br />Business<br />Logic<br />WD<br />Agent<br />Resource<br />Allocator<br />Event<br />Broker<br />
    46. 46. WatchDog<br />WDWatcher<br />Service B<br />Service A<br />
    47. 47. WatchDog<br />Call Recovery<br />X<br />
    48. 48.
    49. 49. Service Monitor<br />Collect<br /> Metrics <br />collection<br />Status<br />Fault <br />Monitoring<br /> Reporting &<br />Dashboarding<br />Edge/Service<br />Security <br />monitoring<br />Status<br />Policy<br />governance<br />Notify<br />Commands<br />Control<br />In<br />Monitor<br />Act<br />Edge/Service<br />Service Monitor<br />
    50. 50. Image of the site-manager<br />
    51. 51. Keep the BIT<br />http://www.flickr.com/photos/37643027@N00/2050024263/sizes/o/<br />
    52. 52. WatchDog<br />Call Recovery<br />X<br />WatchDog<br />3G Call<br />Liveliness Monitor<br />
    53. 53. Challenge - Reporting<br />
    54. 54. Reporting?! BI? but the data is fragmented<br />
    55. 55. Aggregated Reporting<br />EndPoint<br />Produce <br />reports<br />Request<br />Request<br />Report<br />ODS<br />report<br />Transpose<br />Out<br />EndPoint<br />Join<br />Convert<br />Send<br />Poll Data<br />Save Data<br />Clean<br />Pre-Proces<br />Subscribed/<br />Polled data<br />Load<br />Transform<br />Edge<br />Aggregated Reporting Service<br />
    56. 56. Challenge – Multi-tennancy(lies, I tell you, all lies)<br />
    57. 57. Same event different subscribers<br />Call Flow<br />Player<br />(interaction Renderer)<br />Play Movie<br />Event<br />Call Flow<br />Bridge to 3rd<br />Party<br />
    58. 58. Routing<br />
    59. 59. Raise a saga initiating event<br />Initiator A<br />Participant A<br />Capacity : 2<br />Participant B<br />Capacity : 1<br />Initiator B<br />Now what ?!<br />
    60. 60. Reservation Pattern<br />
    61. 61. Business <br />Logic<br />Control<br />Edge<br />Event<br />Broker<br />Resource<br />Allocator<br />Service Host<br />Service Instance #1<br />Service Instance #2<br />Business <br />Logic<br />Control<br />Edge<br />Business <br />Logic<br />Control<br />Edge<br />Business <br />Logic<br />Control<br />Edge<br />Service Host<br />Reservation <br />Event<br />Broker<br />Event<br />Broker<br />Event<br />Broker<br />Resource<br />Allocator<br />Resource<br />Allocator<br />Resource<br />Allocator<br />Service Host<br />Service Host<br />Service Host<br />Service Host<br />Service Host<br />Service Host<br />
    62. 62. Good old 2PC to the rescue<br />

    ×