Top Banner
1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation Session Code: ARCSYM1
50

1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Dec 16, 2015

Download

Documents

Todd Nash
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

1

Envisioning the Service-Oriented Architecture

Pat Helland Dave CampbellArchitect General ManagerMicrosoft Corporation SQL Server Engine

Microsoft Corporation

Session Code: ARCSYM1

Page 2: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 2

OutlineOutline

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

Page 3: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 3

Services and the EnterpriseServices and the EnterpriseUbiquitous Services

Lots of Work on Services as a General Mechanism

Services in the Small and Services in the Large

Longhorn, Services, and Web ServicesServices Will Enhance the Programming ModelTools and Frameworks Will Make This EasierWeb Services Offer Standardized Interoperability

Zooming Out to the EnterpriseWe Will Talk About the Enterprise Usage of ServicesMore Prescriptive (Yet Compatible)

Platform Independent Architecture Discussion

Deliberately Focusing on Concepts and TechniquesApplicable Across Many Platforms

Ubiquitous ServicesLots of Work on Services as a General Mechanism

Services in the Small and Services in the Large

Longhorn, Services, and Web ServicesServices Will Enhance the Programming ModelTools and Frameworks Will Make This EasierWeb Services Offer Standardized Interoperability

Zooming Out to the EnterpriseWe Will Talk About the Enterprise Usage of ServicesMore Prescriptive (Yet Compatible)

Platform Independent Architecture Discussion

Deliberately Focusing on Concepts and TechniquesApplicable Across Many Platforms

Page 4: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 4

Challenges with a Service-Oriented EnterpriseChallenges with a Service-Oriented Enterprise

Apps Have Developed IndependentlyPurchased and/or Home-Grown

Usually, Apps Built to Work with Humans

Not Designed to Work with Apps

We Need Services and We Need to:Surround Existing Apps to Play as Services

Apps Have Developed IndependentlyPurchased and/or Home-Grown

Usually, Apps Built to Work with Humans

Not Designed to Work with Apps

We Need Services and We Need to:Surround Existing Apps to Play as Services

Page 5: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 5

What’re We Gonna Talk About?What’re We Gonna Talk About?

Avoiding AmbiguityAvoiding Ambiguityin Messagesin Messages

What to consider when writing messages to ensureWhat to consider when writing messages to ensurethey are understood by your partnerthey are understood by your partner

Services forServices forthe Enterprisethe Enterprise

Special considerations for using services forSpecial considerations for using services forenterprise class applicationsenterprise class applications

Message Delivery inMessage Delivery inthe Mean, Cruel Worldthe Mean, Cruel World

Connecting apps (services) with messages has Connecting apps (services) with messages has many pitfalls and failure windows… What to do?many pitfalls and failure windows… What to do?

Implementing YourImplementing YourBusiness-ServiceBusiness-Service

Messages, data, and transactions… How can weMessages, data, and transactions… How can wemake an enterprise class service work?make an enterprise class service work?

Embracing andEmbracing andExtend Your AppsExtend Your Apps

I’ve got a LOT of existing applications… How canI’ve got a LOT of existing applications… How canthey be tied into the services game?they be tied into the services game?

Practical Advice for BuildingPractical Advice for BuildingYour Services Your Services NowNow ! !

Page 6: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 6

OutlineOutline

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

Page 7: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 7

Messages Are SpecialMessages Are SpecialBetween Services is Special

Messages Are Sent and Float Around Between

Special Care Is Needed to Understand Them

Can Be Confusion About Interpreting Them

Between Services is SpecialMessages Are Sent and Float Around Between

Special Care Is Needed to Understand Them

Can Be Confusion About Interpreting Them

MSGMSG

MSGMSG

MSGMSG

MSGMSG

MSGMSG

MSGMSG MSGMSG

MSGMSG

ServiceService

ServiceService

ServiceServiceServiceServiceServiceService

ServiceServiceServiceService

ServiceService

ServiceService

No Man’s Land!

Page 8: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 8

Immutable and/or Versioned DataImmutable and/or Versioned DataData May Be Immutable

Once Written, It Is UnchangeableImmutable Data Needs an ID

From the ID, Comes the Same DataNo Matter When, No Matter Where

Versions Are ImmutableEach New Version Is IdentifiedGiven the Identifier, the Same Data Comes

Version Independent IdentifiersLet You Ask for a Recent Version

Data May Be ImmutableOnce Written, It Is Unchangeable

Immutable Data Needs an IDFrom the ID, Comes the Same DataNo Matter When, No Matter Where

Versions Are ImmutableEach New Version Is IdentifiedGiven the Identifier, the Same Data Comes

Version Independent IdentifiersLet You Ask for a Recent Version

Windows NT4, SP1Windows NT4, SP1• The Same Set of BitsThe Same Set of Bits Every Time Every Time

New York Times; 7/3/03 New York Times; 7/3/03 • Specific Version of the Paper Specific Version of the Paper -- Contents Don’t Change -- Contents Don’t Change

Latest SP of NT4Latest SP of NT4• Definitely NT4, Definitely NT4, Results Vary Over Time Results Vary Over Time

Recent NY TimesRecent NY Times• Maybe Today’s,Maybe Today’s, Maybe Yesterday’s Maybe Yesterday’s

VersionIndependent

Page 9: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 9

Stability of Data and Meta-DataStability of Data and Meta-Data

Immutability Isn’t Enough!We Need a Common UnderstandingPresident Bush 1990 vs. President Bush 2003

Stable Data Has a Clearly Understood Meaning

The Schema Must Be Clearly UnderstoodThe Interpretation of Values Must Be Unambiguous

Immutability Isn’t Enough!We Need a Common UnderstandingPresident Bush 1990 vs. President Bush 2003

Stable Data Has a Clearly Understood Meaning

The Schema Must Be Clearly UnderstoodThe Interpretation of Values Must Be Unambiguous

AdviceAdvice• Don’t Recycle Don’t Recycle Customer-IDs Customer-IDs

ObservationObservation• Anything CalledAnything Called “Current” Is Not Stable “Current” Is Not Stable

SuggestionSuggestion• Timestamping or Timestamping or Versioning Makes Versioning Makes Stable Data Stable Data

ObservationObservation• A Monthly Bank StatementA Monthly Bank Statement Is Stable Data Is Stable Data

Page 10: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 10

Normalization & Read-Only DataNormalization & Read-Only Data

Databases Design for Normalized DataCan Be Changed Without “Funny Behavior”Each Data Item Lives in One Place

Sometimes Data Should Be De-Normalized

If Data Is Read-Only

Databases Design for Normalized DataCan Be Changed Without “Funny Behavior”Each Data Item Lives in One Place

Sometimes Data Should Be De-Normalized

If Data Is Read-Only

Emp # Emp Name Mgr # Mgr NameEmp Phone Mgr Phone

47 Joe 13 Sam5-1234 6-9876

18 Sally 38 Harry3-3123 5-6782

91 Pete 13 Sam2-1112 6-9876

66 Mary 02 Betty5-7349 4-0101

Classic problemwith de-normalization

Can’t updateSam’s phone #since there aremany copies

De-normalization isOK if you aren’t going to update!

Page 11: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 11

To Cache or Not to CacheTo Cache or Not to CacheOK to Cache Immutable Data

It’s Never WrongNever Have to Shoot Down the Cache!

Consider Stability of the DataDon’t Want to Misunderstand It

Messages Are Easily CachedThey Should Be Immutable and Stable

Reference Data Should Be VersionedThe Version Is Immutable

Some Data Should Not Be CachedIf It Changes, the Cache May Be Out of Sync

OK to Cache Immutable DataIt’s Never WrongNever Have to Shoot Down the Cache!

Consider Stability of the DataDon’t Want to Misunderstand It

Messages Are Easily CachedThey Should Be Immutable and Stable

Reference Data Should Be VersionedThe Version Is Immutable

Some Data Should Not Be CachedIf It Changes, the Cache May Be Out of Sync

Page 12: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 12

Validity of Data in Bounded Space and TimeValidity of Data in Bounded Space and Time

Bounding the Valid TimesIt May Have an Expiration

Bounding the Valid LocationsRestrictions on Where the Data Is Valid

When Valid, the Data Should Be:Immutable (the ID Yields the Same Bits)Stable (the Meaning Is Clear)

Bounding the Valid TimesIt May Have an Expiration

Bounding the Valid LocationsRestrictions on Where the Data Is Valid

When Valid, the Data Should Be:Immutable (the ID Yields the Same Bits)Stable (the Meaning Is Clear)

““Offer Good to Washington State Residents Only”Offer Good to Washington State Residents Only”

““Offer Good Until Next Tuesday”Offer Good Until Next Tuesday”

Data Valid For Service-X OnlyData Valid For Service-X OnlyPrice-List Valid Price-List Valid Until Dec 31stUntil Dec 31st

Page 13: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 13

Rules for Sending Data in MessagesRules for Sending Data in Messages

Identify theIdentify theMessageMessage

Put Unique ID in All MessagesPut Unique ID in All MessagesPart of the Unique ID May Be a Version…Part of the Unique ID May Be a Version…

ImmutableImmutableDataData

Don’t Change the Data Associated withDon’t Change the Data Associated withthe Unique ID; Never Return Different Bitsthe Unique ID; Never Return Different Bits

OK toOK toCacheCache The Same Bits Will Always Be ReturnedThe Same Bits Will Always Be Returned

Define ValidDefine ValidRangesRanges

Valid for a Certain Time Period and OverValid for a Certain Time Period and OverSome Space; OK to Always Be ValidSome Space; OK to Always Be Valid

Must BeMust BeStableStable

Must Ensure There Is Never Any ConfusionMust Ensure There Is Never Any ConfusionAbout the Meaning (Within Valid Range)About the Meaning (Within Valid Range)

Page 14: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 14

OutlineOutline

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

Page 15: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 15

Services and Business ServicesServices and Business ServicesServices Provide a Name for Messaging

Messages Target the Service

Enterprises Need Business-ServicesProjects One or More Services to the Outside WorldEncapsulates Some Database Resident DataImplemented with Business-Logic

Business-Services Are a Prescriptive Usage for Services

Comply with the General MechanismOK to Use Web-Services for InteroperabilityOK to Use Some Other Mutually Agreed Protocol

Services Provide a Name for MessagingMessages Target the Service

Enterprises Need Business-ServicesProjects One or More Services to the Outside WorldEncapsulates Some Database Resident DataImplemented with Business-Logic

Business-Services Are a Prescriptive Usage for Services

Comply with the General MechanismOK to Use Web-Services for InteroperabilityOK to Use Some Other Mutually Agreed Protocol

DataDataSQLSQL

BusinessBusinessServiceService

ServicesServices

Page 16: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 16

Complete Encapsulation of Data in a Business-ServiceComplete Encapsulation of Data in a Business-Service

Business-Services Encapsulate Their DataThe Only Way to the Data Is Via Messaging

Messages Contain:Operation Requests

Perform a Business FunctionOperation Responses

Describe the Outcome and Provide Any ResultsProcessed Data

Carefully Designed for Outside UseSometimes Export for Data Warehousing

Always to a Trusted Partner Node

Business-Services Encapsulate Their DataThe Only Way to the Data Is Via Messaging

Messages Contain:Operation Requests

Perform a Business FunctionOperation Responses

Describe the Outcome and Provide Any ResultsProcessed Data

Carefully Designed for Outside UseSometimes Export for Data Warehousing

Always to a Trusted Partner Node

DataData

SQLSQLThe Data Is Completely

Encapsulated Withinthe Business-Service

Page 17: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 17

Storing Data that Is Encapsulated in a Business-Service

Storing Data that Is Encapsulated in a Business-ServiceA Business-Service Should Use SQL to Store

DataMany Advantages for Enterprise Use

Data Lives in a Set of Partitions of a Set of Tables

Set of TablesBusiness-Service Implements a Set of ServicesThese Services Each Use a Set of Tables

Set of PartitionsSometimes a Business-Service Is Partitioned

Each Business-Service’s Data Should Live in aSingle Database Engine

If You Can’t Get It Into One Engine, Make Two Business-Services

A Business-Service Should Use SQL to Store Data

Many Advantages for Enterprise Use

Data Lives in a Set of Partitions of a Set of Tables

Set of TablesBusiness-Service Implements a Set of ServicesThese Services Each Use a Set of Tables

Set of PartitionsSometimes a Business-Service Is Partitioned

Each Business-Service’s Data Should Live in aSingle Database Engine

If You Can’t Get It Into One Engine, Make Two Business-Services

Page 18: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 18

Business-Services Are ServicesBusiness-Services Are ServicesBusiness-Service IS a Service

From the Outside, You Can’t Tell the DifferenceIt is About Design and Implementation!

Business-Service IS a ServiceFrom the Outside, You Can’t Tell the DifferenceIt is About Design and Implementation!

OtherOtherServiceService

OtherOtherServiceService

SQLSQL

Biz-ServiceBiz-Service

SQLSQL

Biz-ServiceBiz-Service

OtherOtherServiceService

OtherOtherServiceService

Page 19: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 19

Composite Business-ServicesComposite Business-ServicesA Business-Service May Be Implemented

by Many Business-ServicesPerhaps on Many MachinesEssential for Scale-Out Solutions

Must Look Like a Single Business-ServiceCan’t Tell from the Outside

A Business-Service May Be Implemented by Many Business-Services

Perhaps on Many MachinesEssential for Scale-Out Solutions

Must Look Like a Single Business-ServiceCan’t Tell from the Outside

Business-ServiceBusiness-Service

Biz-SvcBiz-Svc

Biz-SvcBiz-Svc

Biz-SvcBiz-Svc

Biz-SvcBiz-Svc

Biz-SvcBiz-Svc

Biz-SvcBiz-Svc

Biz-SvcBiz-Svc

Communication withCommunication withthe outside worldthe outside world

Page 20: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 20

Business-ServiceBusiness-Service

Composite Services and Scale-OutComposite Services and Scale-OutScale-Out Trick:

Load-Balanced Bank

of Compute EnginesPartitioned Bank of Database Engines

Multi-Message Conversation

Stored in DatabaseFind Right Partition

Centralized Back-End Service

Manages Shared Resources

Scale-Out Trick:Load-Balanced Bank

of Compute EnginesPartitioned Bank of Database Engines

Multi-Message Conversation

Stored in DatabaseFind Right Partition

Centralized Back-End Service

Manages Shared Resources

Back-EndBack-EndBiz-SvcBiz-Svc

BizBizLogicLogic

BizBizLogicLogic

BizBizLogicLogic

BizBizLogicLogic

The Soul ofthe Biz-Service

Is the SQLDatabase!

The Soul ofthe Biz-Service

Is the SQLDatabase!

Biz-SvcBiz-Svc

Biz-SvcBiz-Svc

Biz-SvcBiz-Svc Service-toService-toServiceService

MessagingMessaging

SQLSQL

LogicLogic

SQLSQL

A-JA-J

SQLSQL

K-QK-Q

SQLSQL

R-ZR-Z

Page 21: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 21

OutlineOutline

IntroductionAvoiding Ambiguity in MessagesServices for the Enterprise Message Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

IntroductionAvoiding Ambiguity in MessagesServices for the Enterprise Message Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

Page 22: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 22

Any Form of Messaging is OKAny Form of Messaging is OKMany Kinds of Messaging

Email, IP, TCP/IP, HTTP, MSMQ, MQ-Series, and moreAdvantages and Disadvantages to Each

HTTP is Ubiquitous (Huge Advantage)MQ-Series – Lots of PlatformsEmail (Over SMTP) is Ubiquitous (Huge Advantage)

Ubiquity Is EssentialConnecting Within Your EnterpriseConnecting With Your Partners

OK to Have Some Message LossWe Will Discuss How to Cope with This

Many Kinds of MessagingEmail, IP, TCP/IP, HTTP, MSMQ, MQ-Series, and more

Advantages and Disadvantages to EachHTTP is Ubiquitous (Huge Advantage)MQ-Series – Lots of PlatformsEmail (Over SMTP) is Ubiquitous (Huge Advantage)

Ubiquity Is EssentialConnecting Within Your EnterpriseConnecting With Your Partners

OK to Have Some Message LossWe Will Discuss How to Cope with This

Your PartnersYour PartnersYour EnterpriseYour Enterprise

ServiceService ServiceServiceServiceService ServiceService ServiceService ServiceService

Some Form of Message BusSome Form of Message Bus

Page 23: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 23

What is Guaranteed Message Delivery?What is Guaranteed Message Delivery?

Guaranteed Message DeliveryThe Message Gets to Queue or Sender Is ToldMSMQ, MQ-Series, and Others…

Need to Know the Service Processed Message

And Was the Processing Successful?

Need to Know the Response to the Message

The Service Got the MessageThe Service Processed the MessageWhat Was the Outcome?

Knowing It’s In the Queue Isn’t Enough…

Guaranteed Message DeliveryThe Message Gets to Queue or Sender Is ToldMSMQ, MQ-Series, and Others…

Need to Know the Service Processed Message

And Was the Processing Successful?

Need to Know the Response to the Message

The Service Got the MessageThe Service Processed the MessageWhat Was the Outcome?

Knowing It’s In the Queue Isn’t Enough…

Page 24: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 24

IdempotenceIdempotenceRequests Get Lost…

Gotta Retry Them to Handle Lost Requests

Requests Arrive More than Once…Those Pesky Retries May Actually Arrive

Idempotent Means It’s OK to Arrive Multiple TimesAs Long as the Request Is Processed at Least Once, the Correct Stuff Occurs

In Today’s Internet, You Must Design Your Requests to Be Idempotent

Requests Get Lost…Gotta Retry Them to Handle Lost Requests

Requests Arrive More than Once…Those Pesky Retries May Actually Arrive

Idempotent Means It’s OK to Arrive Multiple TimesAs Long as the Request Is Processed at Least Once, the Correct Stuff Occurs

In Today’s Internet, You Must Design Your Requests to Be Idempotent

Not IdempotentNot IdempotentBaking a CakeBaking a CakeStarting fromStarting fromIngredientsIngredients

Naturally IdempotentNaturally IdempotentSweeping the FloorSweeping the Floor

Naturally IdempotentNaturally IdempotentRead Record “X”Read Record “X”

IdempotentIdempotentIf Haven’t Yet DoneIf Haven’t Yet DoneWithdrawal #XYZWithdrawal #XYZfor $1 Billion,for $1 Billion,Then WithdrawThen Withdraw$1 Billion and$1 Billion andLabel as #XYZLabel as #XYZ

Not IdempotentNot IdempotentWithdrawingWithdrawing$1 Billion$1 Billion

IdempotentIdempotentBaking a CakeBaking a CakeStarting fromStarting fromthe Shoppingthe ShoppingList (If MoneyList (If MoneyDoesn’t Matter)Doesn’t Matter)

Page 25: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 25

ServiceService

Challenges with Multiple MessagesChallenges with Multiple MessagesAny Message May Arrive Multiple

TimesEven After a Long While

This Can Be Very Confusing…Lots of Possible Message Deliveries

Any Message May Arrive Multiple Times

Even After a Long While

This Can Be Very Confusing…Lots of Possible Message Deliveries

Arrg!

ServiceService AABBCC AABBAACCAA

Page 26: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 26

Using Request-Response with IdempotenceUsing Request-Response with Idempotence

You Can Ensure the Processing Occurs In-Order!

Make Each Request IdempotentRetries Won’t Matter…

Use Request/Response PairsEach Request Submitted Has a Matching Response

Implement Timeout and RetryIf You Don’t Get a Response, After a While, Try Again

Request/Response with Idempotence Works!

It Works Even Over Flakey MessagingThe Response Comes from the Service ItselfMuch Better than Guaranteed Messaging

Request/Response Can Be ConstrainingIdempotence Can Be a Difficulty

Discussion Below about How to Ease that Pain

You Can Ensure the Processing Occurs In-Order!

Make Each Request IdempotentRetries Won’t Matter…

Use Request/Response PairsEach Request Submitted Has a Matching Response

Implement Timeout and RetryIf You Don’t Get a Response, After a While, Try Again

Request/Response with Idempotence Works!

It Works Even Over Flakey MessagingThe Response Comes from the Service ItselfMuch Better than Guaranteed Messaging

Request/Response Can Be ConstrainingIdempotence Can Be a Difficulty

Discussion Below about How to Ease that Pain

Page 27: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 27

RequestRequest

Statefulness and Multi-Message InteractionsStatefulness and Multi-Message InteractionsWhat If a Message Is Related to an Early

Message?How Do We Associate Them?How Do We Remember Data Across Them?

A Conversation Is a Set of Related MessagesRequests Flowing One Way; Responses the Other

Consider Request/Response PairsRicher Patterns Are Harder

There May Be Many On-Going ConversationsEach Must Be Kept Separate in the Database

What If a Message Is Related to an Early Message?

How Do We Associate Them?How Do We Remember Data Across Them?

A Conversation Is a Set of Related MessagesRequests Flowing One Way; Responses the Other

Consider Request/Response PairsRicher Patterns Are Harder

There May Be Many On-Going ConversationsEach Must Be Kept Separate in the Database

ResponseResponseRequestRequest

ConversationConversation

RequestRequest ServiceServiceServiceService

Page 28: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 28

OutlineOutline

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

Page 29: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 29

Service-Private DataService-Private Data

Each Business-Service Has Service-Private Data

Lives Deep InsideSurrounded and Protected by Business LogicKept in a SQL Database for Safe Keeping…

Each Business-Service Has Service-Private Data

Lives Deep InsideSurrounded and Protected by Business LogicKept in a SQL Database for Safe Keeping…

DataDataSQLSQL

Business LogicBusiness Logic Service-Private DataService-Private Data

Business ServiceBusiness Service

Page 30: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 30

Business Logic Surrounds Service-Private DataBusiness Logic Surrounds Service-Private Data

Business Logic Surrounds and Protects the Private DataOnly Changes Approved by Business-Logic

Messages Stimulate WorkLogic Changes Service-Private DataGenerates Outgoing MessagesAtomic Transaction

Business Logic Surrounds and Protects the Private DataOnly Changes Approved by Business-Logic

Messages Stimulate WorkLogic Changes Service-Private DataGenerates Outgoing MessagesAtomic Transaction

ServiceServicePrivatePrivateDataData TransactionTransaction

Service LogicService Logic

Page 31: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 31

Transactions and Multiple ServicesTransactions and Multiple ServicesDistributed Transactions Have Challenges

Performance and AutonomyLong-Running-Business-Operations

Multiple Transactions Over Different Biz-ServicesMultiple Transactions Over Same Biz-ServiceConnected by Messaging

Distributed Transactions Have ChallengesPerformance and Autonomy

Long-Running-Business-OperationsMultiple Transactions Over Different Biz-ServicesMultiple Transactions Over Same Biz-ServiceConnected by Messaging

Purchase OrderPurchase OrderServiceService

CustomerCustomerServiceService

Credit CheckCredit CheckServiceService

Transaction T3Transaction T3Transaction T5Transaction T5 Transaction T4Transaction T4

Transaction T1Transaction T1 Transaction T2Transaction T2

Page 32: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 32

Read-Only RequestsRead-Only RequestsRead-Only Requests Are Idempotent

Read and Re-Read… No ProblemAny of the Answers Are Just Fine

OK to Not Record Read-Only Requests(Arguably) a Big Performance Gain

Most Businesses Want to Log Read Requests

Valuable Data for AnalysisCan Use Initial Read to Set Up Conversation

Read-Only Requests Are IdempotentRead and Re-Read… No ProblemAny of the Answers Are Just Fine

OK to Not Record Read-Only Requests(Arguably) a Big Performance Gain

Most Businesses Want to Log Read Requests

Valuable Data for AnalysisCan Use Initial Read to Set Up Conversation

Page 33: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 33

Building a Conversation for Multiple MessagesBuilding a Conversation for Multiple Messages

Conversations Help with CorrectnessCan Ensure Automatic Idempotence

Even When Changing DataNot for First Message in Conversation

Correlate Messages and DataConnecting Them to Earlier MessagesAllowing Data to Be Correlated

Conversations Must Be Long-Running & Durable

They Live as Records in the Database

Conversations Connect Business-ServicesUsing the SQL Database as the Conversation Storage

Conversations Help with CorrectnessCan Ensure Automatic Idempotence

Even When Changing DataNot for First Message in Conversation

Correlate Messages and DataConnecting Them to Earlier MessagesAllowing Data to Be Correlated

Conversations Must Be Long-Running & Durable

They Live as Records in the Database

Conversations Connect Business-ServicesUsing the SQL Database as the Conversation Storage

Page 34: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 34

Conversation-IDs and Sequence NumbersConversation-IDs and Sequence NumbersConversation-IDs

Any Unique Number (Must Not Recycle)

Sequence-NumbersIncremented for Each Request

Target Service Only Accepts Next in Sequence

A Request Cannot Be Processed TwiceThe Conversation Provides Idempotence

Responses Match the Seq# of the RequestThe Response Cannot Be Processed TwiceThe Responses Are Idempotent

Conversation-IDsAny Unique Number (Must Not Recycle)

Sequence-NumbersIncremented for Each Request

Target Service Only Accepts Next in Sequence

A Request Cannot Be Processed TwiceThe Conversation Provides Idempotence

Responses Match the Seq# of the RequestThe Response Cannot Be Processed TwiceThe Responses Are Idempotent

Page 35: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 35

Remembering the Response for RetriesRemembering the Response for Retries

Retried Requests Sometimes ArriveThe Response May Have Been LostNeed to Regenerate the Response

Don’t Want to Do Request AgainConversations Help with Idempotence

Remember Responses in the Database

If Request Retries, Resend Response

Retried Requests Sometimes ArriveThe Response May Have Been LostNeed to Regenerate the Response

Don’t Want to Do Request AgainConversations Help with Idempotence

Remember Responses in the Database

If Request Retries, Resend Response

Page 36: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 36

Transactionally Protecting Your MessagesTransactionally Protecting Your Messages

Processing a Message Should Be AtomicYou Mustn’t Partially Process the Message

It’s OK to:Do the WorkRecord the Response Not Send the Response Out (Due to Failure)

A Retried Request Will Send the ResponseAlways Wait to Send the Response Until It Is Recorded

Never Send Before Recording

Processing a Message Should Be AtomicYou Mustn’t Partially Process the Message

It’s OK to:Do the WorkRecord the Response Not Send the Response Out (Due to Failure)

A Retried Request Will Send the ResponseAlways Wait to Send the Response Until It Is Recorded

Never Send Before Recording

Page 37: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 37

It’s All About the Messages, Baby!It’s All About the Messages, Baby!Services Revolve Around Messages

Services Are “Black Boxes”Requests Go In; Responses Come OutThe Rest Is an Implementation Detail!

Services Revolve Around MessagesServices Are “Black Boxes”Requests Go In; Responses Come OutThe Rest Is an Implementation Detail!

Business-ServiceBusiness-Service

ServiceServiceLogicLogic ServiceService

PrivatePrivateDataData

Page 38: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 38

It’s All about the Data, Baby!It’s All about the Data, Baby!Messages Are Data!

Work Happens by Changing the Database

Stimulated by MessagesChanges DataRecords Outgoing Responses

A Business-Service Live in the Database!

Messages Are Data!Work Happens by Changing the Database

Stimulated by MessagesChanges DataRecords Outgoing Responses

A Business-Service Live in the Database!

TransactionService LogicService Logic

Service-PrivateService-PrivateDataData

Business-ServiceBusiness-Service

Page 39: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 39

OutlineOutline

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

Page 40: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 40

Goals for Wrapping an Existing AppGoals for Wrapping an Existing App

Most Apps Are Used by Humans

People Know Howto Make Them WorkPeople Add Judgment to Fit the Circumstances

Reduce the Need for People to Use the AppIncrease the Times Machine-to-Machine Works OKThe Goal Is NOT to Eliminate the Need for People

Wrap an App to Look Like a ServiceIncrease the Service-to-Service (App) Work

Most Apps Are Used by Humans

People Know Howto Make Them WorkPeople Add Judgment to Fit the Circumstances

Reduce the Need for People to Use the AppIncrease the Times Machine-to-Machine Works OKThe Goal Is NOT to Eliminate the Need for People

Wrap an App to Look Like a ServiceIncrease the Service-to-Service (App) Work

Page 41: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 41

If you can tap into theApp, you can pretend

to be a human forsome operations

This can allow the Appto look like a Service.

Gaining Entrée to Existing AppsGaining Entrée to Existing AppsHow Do People Get Into the App?

HTML, 3270s, 3-tier, 2-tier, EDI, MQ, etc…

Surround and Interface to AppScreen Scraping, HTML Parsing, etc…

Sometimes This Is Hard!Client-Server Needs App Code Changes

2-Tier Especially Hard

How Do People Get Into the App?HTML, 3270s, 3-tier, 2-tier, EDI, MQ, etc…

Surround and Interface to AppScreen Scraping, HTML Parsing, etc…

Sometimes This Is Hard!Client-Server Needs App Code Changes

2-Tier Especially Hard

BusinessBusinessServiceService

ServicesServices

Page 42: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 42

Identifying Idempotent Sequences of OperationsIdentifying Idempotent Sequences of Operations

Every App Deals with FailurePeople Have ProceduresThese Are Repeated Until Success

Usually Ad-Hoc

Find the Idempotent SequencesA Set of Operations Against the AppEach Separate Op Is NOT IdempotentThe Entire Sequence IS Idempotent

Every App Deals with FailurePeople Have ProceduresThese Are Repeated Until Success

Usually Ad-Hoc

Find the Idempotent SequencesA Set of Operations Against the AppEach Separate Op Is NOT IdempotentThe Entire Sequence IS Idempotent

Deposit $1-Billion

Crash!

Restart

Look to see ifthe deposit happened

If not, deposit$1-Billion

Arrghh!Arrghh!

IdempotentIdempotentSequence ofSequence ofOperationsOperations

Page 43: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 43

Defining the Messaging InterfacesDefining the Messaging InterfacesDefine Messages and Sequences

Map to Business-OperationsSearch for Idempotence!Think in terms of atomic actions

Define Messages and SequencesMap to Business-OperationsSearch for Idempotence!Think in terms of atomic actions

Business-Service

IdempotentSequence of Ops

Look to see ifthe deposit happened

If not, deposit$1-Billion

Page 44: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 44

OutlineOutline

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

IntroductionAvoiding Ambiguity in MessagesServices for the EnterpriseMessage Delivery in the Mean, Cruel WorldImplementing Your Business-ServiceEmbracing and Extending Your Existing AppsConclusion

Page 45: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 45

Envisioning the Service-Oriented EnterpriseEnvisioning the Service-Oriented Enterprise

Services Move Us ForwardLots of Islands of App CodeServices Are for Connecting the Islands!

Independence Is EssentialServices Evolve IndependentlyBuild vs. Buy

Inside Your Company and Across Companies

Connecting Your Disparate Apps Comes First!Hooking to Partners Is Important, Too!

Services Cleave Your ApplicationsThey Cleave Them Apart Into Independent PiecesThey Cleave Them Together Allowing Interaction

Services Move Us ForwardLots of Islands of App CodeServices Are for Connecting the Islands!

Independence Is EssentialServices Evolve IndependentlyBuild vs. Buy

Inside Your Company and Across Companies

Connecting Your Disparate Apps Comes First!Hooking to Partners Is Important, Too!

Services Cleave Your ApplicationsThey Cleave Them Apart Into Independent PiecesThey Cleave Them Together Allowing Interaction

Page 46: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 46

What’s In the Next Talk?What’s In the Next Talk?The Space Between The Space Between

the Servicesthe ServicesWhat goes in the messages being passed betweenWhat goes in the messages being passed betweenservices? What must be considered?services? What must be considered?

The Schema BetweenThe Schema BetweenThe ServicesThe Services

What about the different understandings of data?What about the different understandings of data?Why is XML such a big deal?Why is XML such a big deal?

Service-Agents andService-Agents andService-MastersService-Masters

How is data used inside a service? What are theHow is data used inside a service? What are theusages patterns that can be leveraged?usages patterns that can be leveraged?

Representations Representations of Dataof Data

XML, SQL, Objects! When do I use what? XML, SQL, Objects! When do I use what? Why so many choices?Why so many choices?

Interacting withInteracting withServicesServices

What about long running work with services? What about long running work with services? Can multiple services reach an agreement?Can multiple services reach an agreement?

Interacting with Interacting with Agents and MastersAgents and Masters

Let’s examine some tricks to performing Let’s examine some tricks to performing long-running work with service-agentslong-running work with service-agents

Page 47: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 47

And Now, a Word from Our Sponsor…And Now, a Word from Our Sponsor…

There’s Some Cool Technology Coming!

Web ServicesDefines Interoperability Standards

IndigoDevelopment Tools and Frameworks for Services

Yukon SQL Service BrokerIntegrated Messaging into DatabasesAutomatic Support for Conversational MessagingTransaction Protected Reliable Messaging

There’s Some Cool Technology Coming!

Web ServicesDefines Interoperability Standards

IndigoDevelopment Tools and Frameworks for Services

Yukon SQL Service BrokerIntegrated Messaging into DatabasesAutomatic Support for Conversational MessagingTransaction Protected Reliable Messaging

Page 48: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 48

Build Your Services Now!Build Your Services Now!

Microsoft Is Investing Lots In ServicesWeb Services Define InterOp StandardsLonghorn Makes Service Development Easier

You Can Build Services Now!It’ll Be Easier with Longhorn but Don’t Wait!Your Business Needs ServicesGuidance Available to Help

See http://msdn.microsoft.com/webservices/

Invest Now in Building Service!Separate and Connect Your Apps as Services!

Microsoft Is Investing Lots In ServicesWeb Services Define InterOp StandardsLonghorn Makes Service Development Easier

You Can Build Services Now!It’ll Be Easier with Longhorn but Don’t Wait!Your Business Needs ServicesGuidance Available to Help

See http://msdn.microsoft.com/webservices/

Invest Now in Building Service!Separate and Connect Your Apps as Services!

Page 49: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.

Slide 49

© 2003-2004 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Page 50: 1 Envisioning the Service-Oriented Architecture Pat Helland Dave Campbell Architect General Manager Microsoft Corporation SQL Server Engine Microsoft Corporation.