Windows communication foundation indigo writing reliable and transacted distributed applications l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 25

Windows Communication Foundation (“Indigo”): Writing Reliable and Transacted Distributed Applications PowerPoint PPT Presentation


  • 130 Views
  • Uploaded on
  • Presentation posted in: General

Windows Communication Foundation (“Indigo”): Writing Reliable and Transacted Distributed Applications. Shy “BAD-P” Cohen COM307 Program Manager Connected Systems Division Microsoft Corporation. Moving To Service Orientation. Threads versus Messages BAD P! BAD, BAD P!

Download Presentation

Windows Communication Foundation (“Indigo”): Writing Reliable and Transacted Distributed Applications

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Windows communication foundation indigo writing reliable and transacted distributed applications l.jpg

Windows Communication Foundation (“Indigo”): Writing Reliable and Transacted Distributed Applications

Shy “BAD-P” Cohen

COM307

Program Manager

Connected Systems Division

Microsoft Corporation


Moving to service orientation l.jpg

Moving To Service Orientation

  • Threads versus Messages

    • BAD P! BAD, BAD P!

    • Why don’t you come back? Please hurry… ♫

  • Keeping it Consistent

    • All together now!


Challenges of implementing reliable distributed systems l.jpg

Communication Issues

Network unavailable

Connection drops

Network loses messages

Messages may arrive out of order

Messages may take different paths

Retried messages may arrive after the ones that followed them

Processing Issues

Messages lost when processing fails

Interrelated Messages processed individually

Failure may leave the distributed system in an inconsistent state

Messages can’t be retried without side effects

Retried messages arriving twice, reordering, etc.

Challenges Of Implementing Reliable Distributed Systems


Making it reliable l.jpg

Reliable Sessions

Transactions

Queues

Making It Reliable


Sessions l.jpg

Sessions

Service Instance

Proxy

Channel

Session

Session

Channel


Session state and lifetime l.jpg

Session State And Lifetime


Reliable sessions assurances l.jpg

Reliable Sessions Assurances

  • Messages are delivered exactly once, in the same order as they were sent

    • Alternatively, you can choose to have them delivered in order in which they were received

  • Resilient to

    • Transport disconnections

    • SOAP or transport intermediary failures

  • Features

    • Connection verification and maintenance

    • Congestion and flow control


Reliable sessions enabling l.jpg

Reliable SessionsEnabling

  • Provided on Standard Bindings

    netTcpBinding (off by default)

    wsHttpBinding (off by default)

    wsDualHttpBinding (always on)

  • Can be added to any custom binding

<bindings>

<customBinding>

<binding configurationName=”ReliabilityHTTP”>

<reliableSession/>

<httpTransport/>

</binding>

</customBinding>

</bindings>


Ordered and unordered reliable sessions l.jpg

Ordered And Unordered Reliable Sessions


Keeping it consistent l.jpg

Keeping It Consistent

  • Atomic Transactions versus Compensation

  • Trading off coupling and complexity

    • Atomic Transactions: simpler, tighter coupling

    • Compensation: more complex, looser coupling

  • Both have their place

    • Choose the right model for the situation


Transacted operations l.jpg

Transacted Operations


Transactions summary l.jpg

TransactionsSummary

  • Service Developer (Code)

    • Declares willingness to participate in an incoming (client initiated) transaction on contract operations

      • No transaction sharing on one-way operations! *

    • Specified implementation behavioral aspects at the service and method level

  • Client Developer (Code)

    • Creates transactions

    • Includes services & local TX-ed resources in their scope

  • Service Administrator (Config)

    • On/Off switch controls TX flow support for an endpoint

    • It’s about Trust


Queues l.jpg

Queues

  • Increase availability

    • Mask network or service unavailability

  • Support scale out

    • Multiple readers from a single queue

  • Provide load leveling

    • Handle average, not peak load

  • Are a building block for compensating business transactions

    • Reliable, durable messaging to capture distributed state changes

    • Need to compensate for errors


Queues14 l.jpg

MSMQ

MSMQ

Queues

  • Make one-way operations possible even when the service isn’t available

  • Supported via MSMQ

    • Programmer uses regular WCF channels

    • IT Pro manages the familiar MSMQ service

Service

Client


Basic queued messaging l.jpg

Basic Queued Messaging


Queues composing with txs l.jpg

QueuesComposing with TXs

  • Operation requires 2 transactions

    • TX between client and queue to send

    • Another TX between service and queue to receive

  • If a transaction aborts

    • Message sent under the TX are discarded

    • Messages received under the TX are retried


Queues meps l.jpg

QueuesMEPs

  • Datagrams

    • Standalone messages

    • Can be sent and received with or without using a transaction

    • “Exactly Once” or “Best Effort” delivery

  • “Sessiongram”

    • A grouping of related messages

    • Always processed together under a single TX

    • “Exactly Once, In Order” delivery


Queues transactions and sessions l.jpg

Queues, Transactions, And Sessions


Queues the dead letter queue l.jpg

QueuesThe dead letter queue

  • Stores messages that could not be delivered

  • Can be processed like any other queue

  • New in Windows Vista: User specified DLQ

    • If not specified, the default is the system-wide DLQ

    • With a shared DLQ, processing service needs to implement all the contracts for all the messages going into it

    • Alternatively, use System.Messaging to process messages from the Dead Letter Queue


Queues poison messages l.jpg

QueuesPoison messages

  • Messages for whom processing fails, repeatedly, are considered “poison”

    • Failure = the processing transaction aborted

  • Message properties indicate how many times a message was delivered

MsmqMessageProperty msmqMessageProperty;

msmqMessageProperty = OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name]

as MsmqMessageProperty;

if (prop.TotalAbortCount > myRetryThreshold) { /* Do something */ }


Queues poison messages21 l.jpg

QueuesPoison messages

  • New in Windows Vista: Automatic protection against repeated failures

    • By limiting NUMBER of retries

    • By controlling HOWretries are done

<netProfileMsmqBinding>

<binding configurationName=“QB"

maxImmediateRetries="2"

retryCycleDelay="0:0:10"

maxRetryCycles="3"

rejectAfterLastRetry="false" />

</netProfileMsmqBinding>

3 retry cycles

1st attempt

To Poison Message Queue

2 retries

10 seconds between attempts


Q s failure compensation l.jpg

Q’sFailure compensation

  • Set up compensation services on the sending and receiving sides

<binding configurationName="MyQueueBinding“

...

timeToLive="0:2:0"

deadLetterQueue= "net.msmq://MyClient/private/myCustomDLQ"

/>

<endpoint

address ="net.msmq://MyServer/private/MyQueue;poison/”

bindingSectionName="netProfileMsmqBinding"

bindingConfiguration ="MyQueueBinding"

contractType="Queue.IPurchaseOrder, Queues" />


When faced with challenges l.jpg

When Faced With Challenges

  • WCF provides sophisticated session mgmt

    • Session lifetime and associated state

  • WCF assures

    • … that messages arrive exactly once

    • … in the order in which they were sent

  • WCF provides transacted state management

    • Computation and communication

  • WCF provides high availability

    • Durability, atomicity, and error handling


Community resources l.jpg

Community Resources

  • At the PDC

    • More on Windows Communication Foundation

      • Attend the other WCF presentations

      • Talk to me and the other WCF folks at the Lounge, Ask The Experts, or at any other time

    • More on System.Transactions

      • Go talk to Max (COM lounge) or Jim (FUN lounge)

      • Attend FUN320 tomorrow

    • Do the HOLs: WCF HOLs, FUN HOL13 (TXF & TXR)

  • After the PDC

    • MSDN dev center: http://msdn.microsoft.com/webservices/

    • MSDN Forums

    • Channel 9 tag: http://channel9.msdn.com/tags/Indigo

    • Contact me: [email protected]


Slide25 l.jpg

© 2005 Microsoft Corporation. All rights reserved.

This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


  • Login