34
Architectural choices Architectural choices when building COM(+) when building COM(+) Applications Applications Astrid Hackenberg Astrid Hackenberg class-a class-a astrid.hackenberg@class- astrid.hackenberg@class- a.nl a.nl

Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

  • Upload
    lev

  • View
    21

  • Download
    1

Embed Size (px)

DESCRIPTION

Architectural choices when building COM(+) Applications Astrid Hackenberg class-a [email protected]. Agenda. Application problems Design Patterns Scalability Performance Integration Availability. Application Problems. My application does not scale - PowerPoint PPT Presentation

Citation preview

Page 1: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Architectural choices when Architectural choices when building COM(+) Applicationsbuilding COM(+) Applications

Astrid HackenbergAstrid Hackenbergclass-aclass-aastrid.hackenberg@[email protected]

Page 2: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a
Page 3: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

AgendaAgenda

Application problemsApplication problems Design PatternsDesign Patterns ScalabilityScalability PerformancePerformance IntegrationIntegration AvailabilityAvailability

Page 4: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Application ProblemsApplication Problems

1.1. My application does not scaleMy application does not scale2.2. My application does not performMy application does not perform3.3. My application does not cooperate My application does not cooperate

with my existing investmentswith my existing investments4.4. My application is not always availableMy application is not always available

Page 5: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Design PatternsDesign Patterns

“Patterns complement general but problem-independent analysis and design methods with guidelines for solving specific and concrete problems.”

Page 6: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

What is a Pattern ?What is a Pattern ?

Description of a design structureDescription of a design structure Components & Responsibilities & Components & Responsibilities &

Relationships & CollaborationsRelationships & Collaborations Problem – Solution pairProblem – Solution pair

for a recurring problemfor a recurring problem solution flexible for problem variantssolution flexible for problem variants

Page 7: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Patterns AppliedPatterns Applied

Many Patterns in Microsoft Platform Many Patterns in Microsoft Platform ArchitectureArchitecture BrokerBroker ObserverObserver Model-View-ControllerModel-View-Controller Counted BodyCounted Body ProxyProxy AdapterAdapter Etc.Etc.

Page 8: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

COM+ Remoting ArchitectureCOM+ Remoting Architecture

RPC Channel

Clientapplication

In-processProxy DLL

proxy

Server-sidestub

Objectserver

object

Machine, process, apartment boundary

Page 9: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Broker: Broker: Architectural Pattern AppliedArchitectural Pattern Applied

Client

Client-side

proxy Broker

BridgeServer

Server-side

proxy

Calls Calls

Transfermessage

Transfermessage

Calls

Uses API Uses API

proxy stubCOM+

run-time

RPC channel RPC channel

Page 10: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Proxy: Proxy: Design Pattern AppliedDesign Pattern Applied

Client

Proxy

Real subject

abstract subject

Request

Forwarded request

Response

Forwardedresponse

Type library

COM+object

Page 11: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Types of PatternsTypes of Patterns

Analysis Patterns

ArchitecturalPatterns

Design Patterns

IdiomPatterns

Page 12: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Pattern ElementsPattern Elements

Name

Context

Problem

Solution

All (known) design situations where a problem can occur

Set of forces (system aspects) repeatedly arising in the context, e.g.- requirements- constraints - desirable properties

How to balance the forces by- static aspects (= system architecture): components, relationships, responsibilities - dynamic aspects (= run-time behavior): collaboration, communication

ConsequencesResults of applying the pattern- benefits- trade-offs

Handle to the pattern

Page 13: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Describing PatternsDescribing Patterns

Consistent formatConsistent format Description templateDescription template

GoF (Gang of Four)GoF (Gang of Four)Name; Intent; AKA; Motivation; Applicability; Structure; Participants; Name; Intent; AKA; Motivation; Applicability; Structure; Participants; Collaborations; Consequences; Implementation;Sample Code; Collaborations; Consequences; Implementation;Sample Code; Known Uses; Related PatternsKnown Uses; Related Patterns

Your TemplateYour Template DiagramsDiagrams

CRC-cards CRC-cards (Component,Responsibilities,Collaboration)(Component,Responsibilities,Collaboration) OMT-Object Model OMT-Object Model (Components,Interfaces,Relationships)(Components,Interfaces,Relationships) Object Interaction Object Interaction (Object Message Sequence Chart)(Object Message Sequence Chart)

Page 14: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Why use Patterns ?Why use Patterns ?

Reuse experienceReuse experience Reuse successful designsReuse successful designs Common language to communicate Common language to communicate

about software design (decisions)about software design (decisions) Document software architectureDocument software architecture

Page 15: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Steps to selecting a PatternSteps to selecting a Pattern

2.2. Select the pattern categorySelect the pattern category

1. Specify the problem (sub-problems)

3. Select the problem category

4. Compare pattern problem descriptions

5. Compare pattern consequences(most benefits, least trade-offs)

6. Select the best pattern variant

Page 16: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Application ProblemsApplication Problems

1.1. My application does not scaleMy application does not scale2.2. My application does not performMy application does not perform3.3. My application does not cooperate My application does not cooperate

with my existing investmentswith my existing investments4.4. My application is not always availableMy application is not always available

Page 17: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

My Problem Pattern templateMy Problem Pattern template

NameName Also Known AsAlso Known As BackgroundBackground SymptomsSymptoms Solution(s)Solution(s) Usable PatternsUsable Patterns

Page 18: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

1. My Application does not Scale1. My Application does not Scale

a.k.a. “MS technology does not scale”a.k.a. “MS technology does not scale” BackgroundBackground

By increasing the number of transactions, By increasing the number of transactions, users,… my application behaves differently.users,… my application behaves differently.

SymptomsSymptoms Many network roundtripsMany network roundtrips Many databases callsMany databases calls Heavy memory loadHeavy memory load Many object instances alive during a Many object instances alive during a

transactiontransaction

Page 19: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

1. My Application does not Scale1. My Application does not Scale

SolutionSolution Revisited Scalability:Revisited Scalability:

By adding more resources (memory, disk, network) the By adding more resources (memory, disk, network) the application should scale granular.application should scale granular.

Use a N-tier application architectureUse a N-tier application architecture Minimize network roundtrips Minimize network roundtrips (connection-less programming)(connection-less programming) Minimize database roundtrips Minimize database roundtrips (stateless programming)(stateless programming) Shorten transactions!Shorten transactions!

Usable PatternsUsable Patterns Processor (Façade)Processor (Façade) FlyweightFlyweight

Page 20: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Processor patternProcessor pattern

Client Object BObject AProcessor

Client makes single method call overnetwork

Processor object on server makes method calls to other objects. It’s main purpose is reducing the number of expensive calls the client need to make over the network.

Page 21: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

2. My application does not perform2. My application does not perform

a.k.a. “Visual XXX is a toy”a.k.a. “Visual XXX is a toy” BackgroundBackground

The application does not meet the expected The application does not meet the expected end-to-end performance figures as defined.end-to-end performance figures as defined.

SymptomsSymptoms Object Oriented designObject Oriented design VARIANTVARIANT Database locks and blocksDatabase locks and blocks State only available at database levelState only available at database level Discussions about implementation languageDiscussions about implementation language

Page 22: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

2. My application does not perform2. My application does not perform

SolutionSolution DefineDefine realistic performance goals realistic performance goals Think about Interface Design. Do not go into a Think about Interface Design. Do not go into a

religious OO war…religious OO war… Use interception at client levelUse interception at client level Provide state managementProvide state management Shorten Transactions to avoid locking and Shorten Transactions to avoid locking and

blocking at database levelblocking at database level Usable PatternsUsable Patterns

InterceptorInterceptor Wrapper (Adapter)Wrapper (Adapter)

Page 23: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Interceptor patternInterceptor pattern

Pre- and post processing of callsPre- and post processing of calls Interceptor must know about your interfacesInterceptor must know about your interfaces Fundament of COM+ RuntimeFundament of COM+ Runtime

Interceptor

Client

ObjectObject

ObjectObjectObjectObject

ObjectObjectObjectObject

Page 24: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Acquire late – Release earlyAcquire late – Release early

Acquire database connection late, let Acquire database connection late, let the pool do his work!the pool do his work!

Release as soon as possible!Release as soon as possible! Do work always in the same sequence Do work always in the same sequence

to avoid deadlocksto avoid deadlocks ExampleExample

do work OpenConnection

do database action…(select, insert, etc)Close Connectionhandle results

Page 25: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

3. My application does not cooperate3. My application does not cooperate with my existing investments with my existing investments

a.k.a. “MS is proprietary”a.k.a. “MS is proprietary” BackgroundBackground

Existing applications should work with Existing applications should work with currently working applications. Integration currently working applications. Integration is not a standard feature.is not a standard feature.

SymptomsSymptoms Application islandsApplication islands HandworkHandwork Partly manually batch processesPartly manually batch processes

Page 26: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

3. My application does not cooperate3. My application does not cooperate with my existing investments with my existing investments SolutionSolution

Integrate at data and transaction levelIntegrate at data and transaction level Design for integration; it is not a separate task Design for integration; it is not a separate task

after the projectafter the project Use interfacesUse interfaces Key technologies : Message Queuing and XMLKey technologies : Message Queuing and XML Microsoft technologies: OLE-DB, XML (BizTalk Microsoft technologies: OLE-DB, XML (BizTalk

Server), MSMQ, COM-TIServer), MSMQ, COM-TI Usable PatternsUsable Patterns

AdapterAdapter BridgeBridge FaçadeFaçade

Page 27: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

AdapteeAdapter

Adapter patternAdapter pattern

Makes components with incompatible interfaces Makes components with incompatible interfaces cooperate.cooperate.

Adapter converts from the interface that the client Adapter converts from the interface that the client uses to the interface that the existing application uses to the interface that the existing application has and passes on the request.has and passes on the request.

BizTalkBizTalk

Client

Target

Adapter AdapteeRequest Specific Request

Page 28: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

4. My application is not always available4. My application is not always available

a.k.a. “Microsoft technology is not a.k.a. “Microsoft technology is not enterprise ready”enterprise ready”

BackgroundBackground Application should be available Application should be available

24hours/7 days week. An up-time of 24hours/7 days week. An up-time of 99.9999% is required…99.9999% is required…

SymptomsSymptoms System crashesSystem crashes Expensive hardware purchasesExpensive hardware purchases High deployment costsHigh deployment costs

Page 29: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

4. My application is not always available4. My application is not always available

SolutionSolution Revisit “Availability”. What do we mean with availability?Revisit “Availability”. What do we mean with availability? Again, availability is an design issue. Not something Again, availability is an design issue. Not something

during deployment!during deployment! Use Components (hardware industry)Use Components (hardware industry) Design for machine independencyDesign for machine independency Use Message QueuingUse Message Queuing Use Load Balancing when appropriateUse Load Balancing when appropriate

Usable PatternsUsable Patterns Client – Dispatcher – ServerClient – Dispatcher – Server MediatorMediator

Page 30: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Availability – Load BalancingAvailability – Load Balancing

Load BalancingLoad Balancing Increases AvailabilityIncreases Availability Increases ScalabilityIncreases Scalability

Design components for Load Design components for Load BalancingBalancing

No hardware/ system dependenciesNo hardware/ system dependencies Think about WLBS vs. CLBSThink about WLBS vs. CLBS

Page 31: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Client-Dispatcher-Server patternClient-Dispatcher-Server pattern

Provides location transparencyProvides location transparency Server registers itself with dispatcher.Server registers itself with dispatcher. Client asks dispatcher for a communication channel to Client asks dispatcher for a communication channel to

server.server. Dispatcher establishes communication link and returns Dispatcher establishes communication link and returns

channel to client.channel to client.

Client

Dispatcher

Server

Requestsconnection Establishes

connection

Communication channel

Page 32: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Take-a-ways…Take-a-ways…

Manage expectationsManage expectations Use design patterns where appropriateUse design patterns where appropriate Design for Scalability, Performance, Design for Scalability, Performance,

Integration and AvailabilityIntegration and Availability Focus on design, instead of Focus on design, instead of

technologytechnology

Page 33: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a

Some Books…Some Books…

Design Patterns (GoF)Design Patterns (GoF) Addison-Wesley, ISBN 0-201-63361-2Addison-Wesley, ISBN 0-201-63361-2

A System of PatternsA System of Patterns Wiley, ISBN 0-471-95869-7Wiley, ISBN 0-471-95869-7

Pattern HatchingPattern Hatching Addison-Wesley, ISBN 0-201-43293-5Addison-Wesley, ISBN 0-201-43293-5

Page 34: Architectural choices when building COM(+) Applications Astrid Hackenberg class-a