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
Architectural choices when Architectural choices when building COM(+) Applicationsbuilding COM(+) Applications
Astrid HackenbergAstrid Hackenbergclass-aclass-aastrid.hackenberg@[email protected]
AgendaAgenda
Application problemsApplication problems Design PatternsDesign Patterns ScalabilityScalability PerformancePerformance IntegrationIntegration AvailabilityAvailability
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
Design PatternsDesign Patterns
“Patterns complement general but problem-independent analysis and design methods with guidelines for solving specific and concrete problems.”
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
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.
COM+ Remoting ArchitectureCOM+ Remoting Architecture
RPC Channel
Clientapplication
In-processProxy DLL
proxy
Server-sidestub
Objectserver
object
Machine, process, apartment boundary
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
Proxy: Proxy: Design Pattern AppliedDesign Pattern Applied
Client
Proxy
Real subject
abstract subject
Request
Forwarded request
Response
Forwardedresponse
Type library
COM+object
Types of PatternsTypes of Patterns
Analysis Patterns
ArchitecturalPatterns
Design Patterns
IdiomPatterns
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
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)
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
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
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
My Problem Pattern templateMy Problem Pattern template
NameName Also Known AsAlso Known As BackgroundBackground SymptomsSymptoms Solution(s)Solution(s) Usable PatternsUsable Patterns
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
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
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.
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
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)
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
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
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
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
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
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
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
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
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
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
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