SlideShare una empresa de Scribd logo
1 de 62
Windows Azure User Group Event Driven Architecture on the Azure Services Platform27/05/2010
Yours truly Yves Goeleven Solution Architect @ Capgemini MS Community Lead @ Capgemini Board member @ Azug Contact me @ Cloudshaper.wordpress.com Mscop.be.capgemini.com Twitter.com/YvesGoeleven Facebook Linkedin Yves@goeleven.com
Introduction What are we going to discuss today?
Agenda Introduction Design challenges Event driven architecture Event Flow Layers Event Processing Styles Extreme Loose coupling Relationship to CQRS Answering the challenges Technology Mapping Demo & Implementation Details Questions
Windows Azure
.Net Service Bus
SQL Azure Business Analytics Reporting Data Sync Database
The beauty of cloud computing Infinite compute and storage capacity On demand Extreme flexibility Without upfront investments Reduces overall costs Better for the environment
Design challenges Aren’t there any downsides to cloud computing then?
Impact of scale Large scale systems suffer from Data latency No distributed transactions Global systems  No guaranteed instance availability
Latency Azure Fabric Data overlay Data replication over peers Multiple failure & upgrade domains Machines in different racks Or even different datacenters Depending on traffic and data size This might lead to latency
No distributed transactions The very nature of 2 phase commit Makes each machine confirm twice in the commit process Adding more machines Makes the commit process exponentially slower This drastically limits scalability So distributed transactions are not supported in the cloud!
Instance availability Azure is a global platform Can be used by anyone from anywhere, 24 / 7 No windows for maintenance and upgrades The automated update system will take your system down  whenever it feels like it! Failure & upgrade domains counteract this Need at least 2 instances of each role
Traditional composite SOA Synchronous request reply integration  It assumes little to no latency It assumes data from queries to be accurate It assumes distributed transactions To undo the work of services in case of failure It assumes service availability As consumer is waiting for service completion
Event Driven Architecture If synchronous composite SOA is unsuitable for the cloud, what is?
What’s an event anyway Notable, interesting, thing that happens in the business State change, opportunity, threshold, deviation From a technical perspective Message: header & payload Events are completely self descriptive All relevant state is encapsulated But whom decides what ‘interesting’ means?
Inversion of communication Event generators EventStream Time Eventconsumers
Eventflowlayers Event generator Event Channel Event Processing Engine Downstream activity Event Processing Actions Publish Event Processing Engine Notify Standing Query Invoke service Start business process Capture
Event Processing Styles What does ‘interesting event’ mean ?
SimpleEvent Processing Event generator Event Channel Event Processing Engine Downstream activity Event Processing Actions Publish Event Processing Engine Notify Simple Event Invoke service Start business process Capture
StreamEvent Processing Event generator Event Channel Event Processing Engine Downstream activity Event Processing Actions Publish Event Processing Engine Notify Simple Event Invoke service Start business process Capture
Complex Event Processing Event generator Event Channel Event Processing Engine Downstream activity Event Processing Actions Publish Event Processing Engine Notify Simple Event Invoke service Complex Event Series Start business process Capture
Extreme Loose Coupling Event driven architecture delivers…
Extreme loose coupling Decoupling in multiple dimensions Implementation Event generator and consumer’s implementation are not bound They even don’t know about the other’s existance All information encapsulated in event Distribution Event generator and consumer can be physically separated As long as they can access the event channel
Extreme loose coupling Decoupling (Continued) Time Events encapsulate all information They can be stored for later processing Evolution Event generators and consumers can evolve independently Usually they are ‘added’ instead of ‘changed’, contributing to ease of management
Brewers CAP Theorem A distributed system can satisfy any two of these guarantees at the same time, but not all three Consistency all nodes see the same data at the same time Availability node failures do not prevent survivors from continuing to operate Partition Tolerance The system continues to operate even if it becomes partitioned due to loss of connectivity
Eventual consistency EDA sacrifices consistency But will eventually become consistent Compensating events  Errors and exceptions are events as well And should end up in the event stream Compensating transactions Event Consumers should subscribe to compensating events To make things right again
Eventual consistency Local transactions, or similar mechanics, are still supported So even if a role goes down while processing a compensating event The local transaction will ensure that the event gets processed later Event consumers must be completely autonomous They should not rely on other services The long forgotten SOA principle ‘Service Autonomy’, is mandatory in an EDA
Service Autonomy How to achieve it? Make every event consumer (aggregate root) a stand alone state machine Blog Comment (Submitted, Accepted, Rejected) Encapsulate state transitions with  Tentative operations  Submit / Accept / Reject Internally it uses  the currently known state  risk mitigation logic
Service Autonomy Give it a memory (Partner state machine) The relevant last known states of it’s remote partners Required to properly implement risk mitigation logic This allows for Stale, locally stored, state  out of order events
Apology based computing Eventual Consistency presents some challenges to the UI Users need to be informed that the system Is working on it, instead of waiting for the result The system will get back to them later In case of failure or success Task oriented UI’s  support this better than data oriented UI’s
Relationship to CQRS Haven’t I seensome of thisbefore?
Similar to CQRS*  Events * Command QueryResponsibilitySegregation Browser Workerrole Web role Submit New  Blog Post Command Request/Reply Publish Query Request/Reply View Recent  Blog Posts
It happened, live with it Events Blog Post  Submitted Workerrole Browser Web role Event Oneway EventStream Query Request/Reply View Recent  Blog Posts
Open for extension ExtensionPoints Blog Post  Submitted Workerrole Browser Web role Event Oneway EventStream Query Request/Reply View Recent  Blog Posts
Answering The Challenges How does all of thissolve the design challenges in the cloud?
Answering the challenges Latency Event consumers listen to what’s happening They react to events when they receive them Time between event occurrence and processing Is probably irrelevant for the event consumer As all information is encapsulated inside the event Take into account that events may arrive out of order Risk mitigation strategies required Based on local state and partner state machine
Answering the challenges Availability If the event channel technology is durable Like azure storage queues Event consumers can go down without impact They will receive the events once they come back up again
Answering the challenges Availability The absence of events in the stream Can be detected by a stream event processing This can result into a new event Triggering a self healing process Or human intervention
Answering the challenges No distributed transactions Compensating events Compensation logic , local transactions Humans can subscribe to them as well To fix the issues manually
Technology Mapping What technology could I use to implement this…
Event channel Table storage queues Durable  might lead to dead queues though Queue management required Supports queue-peek-lock Similar to local transactions .NetServicebus’ messagebuffers Temporarily durable  will disappear if unused Supports queue-peek-lock Similar to local transactions WCF’s Relaybindings Can reach outside of the cloud  Even across NAT &Firewalls No transaction support
Event processing engine Microsoft StreamInsight Stream event processing Complex event processing .NetServicebus used to* have routers Ideal for forwarding events Supported any / all forwarding *Rumored to come back soon
Event processing engine Open source to the rescue NServicebus Library to implement service busses Routing scenarios Publisher (All) Distributor (Any) Simple event processing Message handlers Complex event processing Saga pattern
Demo Canyou show me anexample?
Architecture Web Web Web Web Web Queue Storage StreamInsight NServicebus AzureRoles CEP Publisher Publisher (All) Table Storage Distributor Distributor (Any) Worker Worker Worker Worker Worker
Implementation Details How the helldidyou do that!
NHibernate Interaction with Azure is through REST API’s Manually crafting requests Manually parsing responses Is cumbersome Co-created an NHibernate driver To do the heavy lifting of interacting with table storage Provides persistence ignorance
NhibernateDriver Walkingthrough the code…
NServiceBus Performs messaging on Queue Storage Client API ( IBus ) Server API ( IHandleMessages<T> ) Pub/Sub with durable subscriptions Distribution based on worker availability Uses Nhibernate and azure storage driver internally For all it’s storage needs
NServiceBus Custom extensions Azure Queue Transport Subscription storage  Worker availability management Saga support (not yet finished)
Nservice Bus extensions Walkingthrough the code…
Modules In order to cut costs Modules loaded ad runtime From blob storage For all components Allows for dynamic views, message handlers and CEP queries Plan to switch to MEF StructureMap as IOC Wires it all together
CMS Module WORKER Walkingthrough the code…
StreamInsight Event Event Event Event Event Event Event Event Event Event consumers Event generators CEP Application at Runtime CEP Engine Devices, Sensors Pagers & Monitoring devices Standing Queries Output Adapters Input Adapters Web & Worker Roles Web & Worker roles Event stores & Databases Event Stores & Databases Monitoring Systems Static reference data 55
STREAMINSIGHT EXTENSIONS Walkingthrough the code…
Web Role ASP.Net MVC Heavy use of JQuery Asynchronous semantics WYSYWIG style Extremely apology based Nhibernate’s second level cache on by default Effectively queries memory most of the time Synchronization through events of course Switching to IronRuby as view engine Views stored in blob storage Allows for runtime customization
CMS Module web Walkingthrough the code…
RUNTIME Walkingthrough the code…
Let’sRecap We’refinallythere!
ANY QUESTIONS? Wouldthisguystill have a sociallife?
Thank you for coming! Spread the word! www.azug.be

Más contenido relacionado

La actualidad más candente

A year with event sourcing and CQRS
A year with event sourcing and CQRSA year with event sourcing and CQRS
A year with event sourcing and CQRS
Steve Pember
 
Unlocking the Power of Salesforce Integrations with Confluent
Unlocking the Power of Salesforce Integrations with ConfluentUnlocking the Power of Salesforce Integrations with Confluent
Unlocking the Power of Salesforce Integrations with Confluent
AaronLieberman5
 
"up.time" New Release from uptime software - May, 2010
"up.time" New Release from uptime software - May, 2010"up.time" New Release from uptime software - May, 2010
"up.time" New Release from uptime software - May, 2010
guesta93734
 

La actualidad más candente (20)

Event-Driven Architecture (EDA)
Event-Driven Architecture (EDA)Event-Driven Architecture (EDA)
Event-Driven Architecture (EDA)
 
[WSO2Con Asia 2018] Building Reactive Applications Using Event-driven Archite...
[WSO2Con Asia 2018] Building Reactive Applications Using Event-driven Archite...[WSO2Con Asia 2018] Building Reactive Applications Using Event-driven Archite...
[WSO2Con Asia 2018] Building Reactive Applications Using Event-driven Archite...
 
New Tool for Automating Exchange Management Tasks
New Tool for Automating Exchange Management TasksNew Tool for Automating Exchange Management Tasks
New Tool for Automating Exchange Management Tasks
 
Javascript Today
Javascript TodayJavascript Today
Javascript Today
 
Mobilizing Your Enterprise, Why & How?
Mobilizing Your Enterprise, Why & How?Mobilizing Your Enterprise, Why & How?
Mobilizing Your Enterprise, Why & How?
 
Microsoft Azure For Solutions Architects
Microsoft Azure For Solutions ArchitectsMicrosoft Azure For Solutions Architects
Microsoft Azure For Solutions Architects
 
An Overview of Windows Azure
An Overview of Windows AzureAn Overview of Windows Azure
An Overview of Windows Azure
 
Planning for Synchronization with Browser-Local Databases
Planning for Synchronization with Browser-Local DatabasesPlanning for Synchronization with Browser-Local Databases
Planning for Synchronization with Browser-Local Databases
 
Introduction to Event Driven Architecture
Introduction to Event Driven ArchitectureIntroduction to Event Driven Architecture
Introduction to Event Driven Architecture
 
Mmckeown hadr that_conf
Mmckeown hadr that_confMmckeown hadr that_conf
Mmckeown hadr that_conf
 
A year with event sourcing and CQRS
A year with event sourcing and CQRSA year with event sourcing and CQRS
A year with event sourcing and CQRS
 
Winds of change from vendor lock in to the meta cloud
Winds of change  from vendor lock in  to the meta cloudWinds of change  from vendor lock in  to the meta cloud
Winds of change from vendor lock in to the meta cloud
 
Unlocking the Power of Salesforce Integrations with Confluent
Unlocking the Power of Salesforce Integrations with ConfluentUnlocking the Power of Salesforce Integrations with Confluent
Unlocking the Power of Salesforce Integrations with Confluent
 
JCon 2021 - Loosely or lousily coupled
JCon 2021 - Loosely or lousily coupledJCon 2021 - Loosely or lousily coupled
JCon 2021 - Loosely or lousily coupled
 
CQRS: Command/Query Responsibility Segregation
CQRS: Command/Query Responsibility SegregationCQRS: Command/Query Responsibility Segregation
CQRS: Command/Query Responsibility Segregation
 
"up.time" New Release from uptime software - May, 2010
"up.time" New Release from uptime software - May, 2010"up.time" New Release from uptime software - May, 2010
"up.time" New Release from uptime software - May, 2010
 
Serverless Days 2019 - Lost in transaction
Serverless Days 2019 - Lost in transactionServerless Days 2019 - Lost in transaction
Serverless Days 2019 - Lost in transaction
 
Building Event Driven Systems
Building Event Driven SystemsBuilding Event Driven Systems
Building Event Driven Systems
 
How Do I Know My SQL & Virtual Environments Are Ready for SSD?
How Do I Know My SQL & Virtual Environments Are Ready for SSD?How Do I Know My SQL & Virtual Environments Are Ready for SSD?
How Do I Know My SQL & Virtual Environments Are Ready for SSD?
 
Azure Service Bus for Loosely-Coupled Enterprise Software.
Azure Service Bus for Loosely-Coupled Enterprise Software.Azure Service Bus for Loosely-Coupled Enterprise Software.
Azure Service Bus for Loosely-Coupled Enterprise Software.
 

Similar a Eda on the azure services platform

Don't call us - we'll push - cross tier push architecture (JavaOne 2011)
Don't call us - we'll push - cross tier push architecture (JavaOne 2011)Don't call us - we'll push - cross tier push architecture (JavaOne 2011)
Don't call us - we'll push - cross tier push architecture (JavaOne 2011)
Lucas Jellema
 
Aceu2009 Apache Synapse Events
Aceu2009 Apache Synapse EventsAceu2009 Apache Synapse Events
Aceu2009 Apache Synapse Events
guest60ed0b
 
Introduction to Stream Processing
Introduction to Stream ProcessingIntroduction to Stream Processing
Introduction to Stream Processing
Guido Schmutz
 

Similar a Eda on the azure services platform (20)

Guido schmutz-jax2011-event-driven soa
Guido schmutz-jax2011-event-driven soaGuido schmutz-jax2011-event-driven soa
Guido schmutz-jax2011-event-driven soa
 
Deconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven DesignDeconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven Design
 
A guide through the Azure Messaging services - Update Conference
A guide through the Azure Messaging services - Update ConferenceA guide through the Azure Messaging services - Update Conference
A guide through the Azure Messaging services - Update Conference
 
Don't call us - we'll push - cross tier push architecture (JavaOne 2011)
Don't call us - we'll push - cross tier push architecture (JavaOne 2011)Don't call us - we'll push - cross tier push architecture (JavaOne 2011)
Don't call us - we'll push - cross tier push architecture (JavaOne 2011)
 
Stephane Lapointe & Alexandre Brisebois: Développer des microservices avec Se...
Stephane Lapointe & Alexandre Brisebois: Développer des microservices avec Se...Stephane Lapointe & Alexandre Brisebois: Développer des microservices avec Se...
Stephane Lapointe & Alexandre Brisebois: Développer des microservices avec Se...
 
TechDays 2010 Portugal - Event Driven Architectures - 16x9
TechDays 2010 Portugal - Event Driven Architectures - 16x9TechDays 2010 Portugal - Event Driven Architectures - 16x9
TechDays 2010 Portugal - Event Driven Architectures - 16x9
 
12-Factor App
12-Factor App12-Factor App
12-Factor App
 
SQL Azure Overview - ericnel
SQL Azure Overview - ericnelSQL Azure Overview - ericnel
SQL Azure Overview - ericnel
 
Scalable service architectures @ BWS16
Scalable service architectures @ BWS16Scalable service architectures @ BWS16
Scalable service architectures @ BWS16
 
Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016
 
Event Driven Architecture at NDDNUG
Event Driven Architecture at NDDNUGEvent Driven Architecture at NDDNUG
Event Driven Architecture at NDDNUG
 
Aceu2009 Apache Synapse Events
Aceu2009 Apache Synapse EventsAceu2009 Apache Synapse Events
Aceu2009 Apache Synapse Events
 
Scalable service architectures @ VDB16
Scalable service architectures @ VDB16Scalable service architectures @ VDB16
Scalable service architectures @ VDB16
 
Open Source Event Processing for Sensor Fusion Applications
Open Source Event Processing for Sensor Fusion ApplicationsOpen Source Event Processing for Sensor Fusion Applications
Open Source Event Processing for Sensor Fusion Applications
 
Scalable Service Architectures
Scalable Service ArchitecturesScalable Service Architectures
Scalable Service Architectures
 
Microservices: Breaking Apart the Monolith
Microservices:  Breaking Apart the Monolith Microservices:  Breaking Apart the Monolith
Microservices: Breaking Apart the Monolith
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
 
Introduction to Stream Processing
Introduction to Stream ProcessingIntroduction to Stream Processing
Introduction to Stream Processing
 
Event mesh api meetup AsyncAPI Singapore
Event mesh api meetup AsyncAPI SingaporeEvent mesh api meetup AsyncAPI Singapore
Event mesh api meetup AsyncAPI Singapore
 
Introducing Windows Azure
Introducing Windows Azure Introducing Windows Azure
Introducing Windows Azure
 

Más de Yves Goeleven

Madn - connecting things with people
Madn - connecting things with peopleMadn - connecting things with people
Madn - connecting things with people
Yves Goeleven
 
Windows azure storage services
Windows azure storage servicesWindows azure storage services
Windows azure storage services
Yves Goeleven
 
Azug - successfully breeding rabits
Azug - successfully breeding rabitsAzug - successfully breeding rabits
Azug - successfully breeding rabits
Yves Goeleven
 

Más de Yves Goeleven (10)

Back to the 90s' - Revenge of the static website
Back to the 90s' - Revenge of the static websiteBack to the 90s' - Revenge of the static website
Back to the 90s' - Revenge of the static website
 
Azure storage deep dive
Azure storage deep diveAzure storage deep dive
Azure storage deep dive
 
Io t privacy and security considerations
Io t   privacy and security considerationsIo t   privacy and security considerations
Io t privacy and security considerations
 
Connecting your app to the real world
Connecting your app to the real worldConnecting your app to the real world
Connecting your app to the real world
 
Madn - connecting things with people
Madn - connecting things with peopleMadn - connecting things with people
Madn - connecting things with people
 
Message handler customer deck
Message handler customer deckMessage handler customer deck
Message handler customer deck
 
Cloudbrew - Internet Of Things
Cloudbrew - Internet Of ThingsCloudbrew - Internet Of Things
Cloudbrew - Internet Of Things
 
Windows azure storage services
Windows azure storage servicesWindows azure storage services
Windows azure storage services
 
Azug - successfully breeding rabits
Azug - successfully breeding rabitsAzug - successfully breeding rabits
Azug - successfully breeding rabits
 
Sql Azure
Sql AzureSql Azure
Sql Azure
 

Último

Último (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Eda on the azure services platform

  • 1. Windows Azure User Group Event Driven Architecture on the Azure Services Platform27/05/2010
  • 2. Yours truly Yves Goeleven Solution Architect @ Capgemini MS Community Lead @ Capgemini Board member @ Azug Contact me @ Cloudshaper.wordpress.com Mscop.be.capgemini.com Twitter.com/YvesGoeleven Facebook Linkedin Yves@goeleven.com
  • 3. Introduction What are we going to discuss today?
  • 4. Agenda Introduction Design challenges Event driven architecture Event Flow Layers Event Processing Styles Extreme Loose coupling Relationship to CQRS Answering the challenges Technology Mapping Demo & Implementation Details Questions
  • 7. SQL Azure Business Analytics Reporting Data Sync Database
  • 8. The beauty of cloud computing Infinite compute and storage capacity On demand Extreme flexibility Without upfront investments Reduces overall costs Better for the environment
  • 9. Design challenges Aren’t there any downsides to cloud computing then?
  • 10. Impact of scale Large scale systems suffer from Data latency No distributed transactions Global systems No guaranteed instance availability
  • 11. Latency Azure Fabric Data overlay Data replication over peers Multiple failure & upgrade domains Machines in different racks Or even different datacenters Depending on traffic and data size This might lead to latency
  • 12. No distributed transactions The very nature of 2 phase commit Makes each machine confirm twice in the commit process Adding more machines Makes the commit process exponentially slower This drastically limits scalability So distributed transactions are not supported in the cloud!
  • 13. Instance availability Azure is a global platform Can be used by anyone from anywhere, 24 / 7 No windows for maintenance and upgrades The automated update system will take your system down whenever it feels like it! Failure & upgrade domains counteract this Need at least 2 instances of each role
  • 14. Traditional composite SOA Synchronous request reply integration It assumes little to no latency It assumes data from queries to be accurate It assumes distributed transactions To undo the work of services in case of failure It assumes service availability As consumer is waiting for service completion
  • 15. Event Driven Architecture If synchronous composite SOA is unsuitable for the cloud, what is?
  • 16. What’s an event anyway Notable, interesting, thing that happens in the business State change, opportunity, threshold, deviation From a technical perspective Message: header & payload Events are completely self descriptive All relevant state is encapsulated But whom decides what ‘interesting’ means?
  • 17. Inversion of communication Event generators EventStream Time Eventconsumers
  • 18. Eventflowlayers Event generator Event Channel Event Processing Engine Downstream activity Event Processing Actions Publish Event Processing Engine Notify Standing Query Invoke service Start business process Capture
  • 19. Event Processing Styles What does ‘interesting event’ mean ?
  • 20. SimpleEvent Processing Event generator Event Channel Event Processing Engine Downstream activity Event Processing Actions Publish Event Processing Engine Notify Simple Event Invoke service Start business process Capture
  • 21. StreamEvent Processing Event generator Event Channel Event Processing Engine Downstream activity Event Processing Actions Publish Event Processing Engine Notify Simple Event Invoke service Start business process Capture
  • 22. Complex Event Processing Event generator Event Channel Event Processing Engine Downstream activity Event Processing Actions Publish Event Processing Engine Notify Simple Event Invoke service Complex Event Series Start business process Capture
  • 23. Extreme Loose Coupling Event driven architecture delivers…
  • 24. Extreme loose coupling Decoupling in multiple dimensions Implementation Event generator and consumer’s implementation are not bound They even don’t know about the other’s existance All information encapsulated in event Distribution Event generator and consumer can be physically separated As long as they can access the event channel
  • 25. Extreme loose coupling Decoupling (Continued) Time Events encapsulate all information They can be stored for later processing Evolution Event generators and consumers can evolve independently Usually they are ‘added’ instead of ‘changed’, contributing to ease of management
  • 26. Brewers CAP Theorem A distributed system can satisfy any two of these guarantees at the same time, but not all three Consistency all nodes see the same data at the same time Availability node failures do not prevent survivors from continuing to operate Partition Tolerance The system continues to operate even if it becomes partitioned due to loss of connectivity
  • 27. Eventual consistency EDA sacrifices consistency But will eventually become consistent Compensating events Errors and exceptions are events as well And should end up in the event stream Compensating transactions Event Consumers should subscribe to compensating events To make things right again
  • 28. Eventual consistency Local transactions, or similar mechanics, are still supported So even if a role goes down while processing a compensating event The local transaction will ensure that the event gets processed later Event consumers must be completely autonomous They should not rely on other services The long forgotten SOA principle ‘Service Autonomy’, is mandatory in an EDA
  • 29. Service Autonomy How to achieve it? Make every event consumer (aggregate root) a stand alone state machine Blog Comment (Submitted, Accepted, Rejected) Encapsulate state transitions with Tentative operations Submit / Accept / Reject Internally it uses the currently known state risk mitigation logic
  • 30. Service Autonomy Give it a memory (Partner state machine) The relevant last known states of it’s remote partners Required to properly implement risk mitigation logic This allows for Stale, locally stored, state out of order events
  • 31. Apology based computing Eventual Consistency presents some challenges to the UI Users need to be informed that the system Is working on it, instead of waiting for the result The system will get back to them later In case of failure or success Task oriented UI’s support this better than data oriented UI’s
  • 32. Relationship to CQRS Haven’t I seensome of thisbefore?
  • 33. Similar to CQRS* Events * Command QueryResponsibilitySegregation Browser Workerrole Web role Submit New Blog Post Command Request/Reply Publish Query Request/Reply View Recent Blog Posts
  • 34. It happened, live with it Events Blog Post Submitted Workerrole Browser Web role Event Oneway EventStream Query Request/Reply View Recent Blog Posts
  • 35. Open for extension ExtensionPoints Blog Post Submitted Workerrole Browser Web role Event Oneway EventStream Query Request/Reply View Recent Blog Posts
  • 36. Answering The Challenges How does all of thissolve the design challenges in the cloud?
  • 37. Answering the challenges Latency Event consumers listen to what’s happening They react to events when they receive them Time between event occurrence and processing Is probably irrelevant for the event consumer As all information is encapsulated inside the event Take into account that events may arrive out of order Risk mitigation strategies required Based on local state and partner state machine
  • 38. Answering the challenges Availability If the event channel technology is durable Like azure storage queues Event consumers can go down without impact They will receive the events once they come back up again
  • 39. Answering the challenges Availability The absence of events in the stream Can be detected by a stream event processing This can result into a new event Triggering a self healing process Or human intervention
  • 40. Answering the challenges No distributed transactions Compensating events Compensation logic , local transactions Humans can subscribe to them as well To fix the issues manually
  • 41. Technology Mapping What technology could I use to implement this…
  • 42. Event channel Table storage queues Durable might lead to dead queues though Queue management required Supports queue-peek-lock Similar to local transactions .NetServicebus’ messagebuffers Temporarily durable will disappear if unused Supports queue-peek-lock Similar to local transactions WCF’s Relaybindings Can reach outside of the cloud Even across NAT &Firewalls No transaction support
  • 43. Event processing engine Microsoft StreamInsight Stream event processing Complex event processing .NetServicebus used to* have routers Ideal for forwarding events Supported any / all forwarding *Rumored to come back soon
  • 44. Event processing engine Open source to the rescue NServicebus Library to implement service busses Routing scenarios Publisher (All) Distributor (Any) Simple event processing Message handlers Complex event processing Saga pattern
  • 45. Demo Canyou show me anexample?
  • 46. Architecture Web Web Web Web Web Queue Storage StreamInsight NServicebus AzureRoles CEP Publisher Publisher (All) Table Storage Distributor Distributor (Any) Worker Worker Worker Worker Worker
  • 47. Implementation Details How the helldidyou do that!
  • 48. NHibernate Interaction with Azure is through REST API’s Manually crafting requests Manually parsing responses Is cumbersome Co-created an NHibernate driver To do the heavy lifting of interacting with table storage Provides persistence ignorance
  • 50. NServiceBus Performs messaging on Queue Storage Client API ( IBus ) Server API ( IHandleMessages<T> ) Pub/Sub with durable subscriptions Distribution based on worker availability Uses Nhibernate and azure storage driver internally For all it’s storage needs
  • 51. NServiceBus Custom extensions Azure Queue Transport Subscription storage Worker availability management Saga support (not yet finished)
  • 52. Nservice Bus extensions Walkingthrough the code…
  • 53. Modules In order to cut costs Modules loaded ad runtime From blob storage For all components Allows for dynamic views, message handlers and CEP queries Plan to switch to MEF StructureMap as IOC Wires it all together
  • 54. CMS Module WORKER Walkingthrough the code…
  • 55. StreamInsight Event Event Event Event Event Event Event Event Event Event consumers Event generators CEP Application at Runtime CEP Engine Devices, Sensors Pagers & Monitoring devices Standing Queries Output Adapters Input Adapters Web & Worker Roles Web & Worker roles Event stores & Databases Event Stores & Databases Monitoring Systems Static reference data 55
  • 57. Web Role ASP.Net MVC Heavy use of JQuery Asynchronous semantics WYSYWIG style Extremely apology based Nhibernate’s second level cache on by default Effectively queries memory most of the time Synchronization through events of course Switching to IronRuby as view engine Views stored in blob storage Allows for runtime customization
  • 58. CMS Module web Walkingthrough the code…
  • 61. ANY QUESTIONS? Wouldthisguystill have a sociallife?
  • 62. Thank you for coming! Spread the word! www.azug.be

Notas del editor

  1. Services do not communicate directlyInstead event generators constantly report what is happening Resulting in a stream of eventsEvent consumers may subscribe to these events And might react to them
  2. Event generatorEvent sources come in many forms: Devices, humans, software, nature, …Event generators capture events from the sources, and translate them into a format understood by the event channelEvents are pushed onto the event channel by the generatorEvent ChannelThe event channel is a communication medium,transports the events throughout the systemPreferably it is durable, supports local transactionsAzure offerings that can fulfill this role: Queue storage, .NetServicebus’ messagebuffers, WCF’s RelaybindingsEvent Processing EngineContinuous and incremental processing of event streams with near-zero latencyIdentification of eventsStanding queries (aggregation, grouping, …)Event correlationEvent transformationWindow inspectionEvent forwardingDownstream activityResult of event processingPush : Service Invocation, Notification (Email, sms), Business Process Invocation (Workflow)Pull : Message handler from queue, RSS, Event Stores
  3. Separation betweenreads (queries) and writes (commands)QueryUI queries directly from data storeData is potentially staleIs read-only from a UI perspectiveCan cache the data in memoryWill send messages to the command processing sideCommand processingAsynchronous by defaultTypically on other data or event storedoesn’t make sense for Azure table storageSynchronization Real time by means of eventsOr background processes
  4. Used as a libraryIn a worker roleNot as easy to deploy as it looks …Standing QueriesImplemented with LinqOn top of the CepStream&lt;T&gt; constructCustom AdaptersInput AdapterOutput AdapterImplemented on top of the custom NServiceBus transport for queue storage