Things to think about whilearchitecting Azure solutions
Famous Last Words…“It is a very humbling experience to make a multimillion-dollar mistake, but it is also very memorable….”(Fred Brooks - “Mythical Man-Month” p.47)
So, What is Software Architecture exactly?
Software architecture is the fundamentalorganization of a system, embodied in its components, their relationships to each other and the environment, and the principles governing its design and evolution
Architecture forcesStakeholdersQuality AttributesConstraintsPrinciplesCommunity experienceArchitectArchitecturePatterns & Anti-patternsKeypeopleTechnologyA “deliverable”ProduceIs an input
Dequeue/Delete patternThe  Network is reliable
Dequeue/Delete patternThe  Network is reliableStill a problem If we crash here
Idempotencyf(x) = f(f(x))
Messages Process At Least OnceDebit bank account $100 messageWorker role reads messageBalance debited $100Worker role is torn before message can be deleted3 minutes later, message re-appears on queueWorker role reads messageBalance debited $100Message deleted from queueChaos ensues.....Customer calls bank.....Web RoleWorker RoleBalance = $1000Balance = $900Balance = $800Worker RoleWeb RoleWorker RoleWorker RoleQueueStorageLBLB
Solving the Idempotency ProblemDebit bank account $100 message with transaction IDWorker role reads message. Checks transaction ID not present.Writes transaction ID with state ‘Started’ to ‘Replay Log’Balance debited $100Worker role is torn before message can be deleted3 minutes later, message re-appears on queueWorker role reads message. Checks transaction ID. It is present in state started.Compensating message written to another queueMessage deleted from queueCompensatory message processed.Balance = $1000Balance = $900Web RoleWorker RoleWorker RoleWeb RoleStorageWorker RoleWorker RoleQueryQueryQueueQueueTableLBLB
Latency is zero
It might be infinite for all purposes but it costs…Bandwidth is infinite
Authentication with ACSThe Network is SecureSlide by Alik Levin
Service BusProvides secure messaging and connectivity across different network topologiesEnables hybrid applications that span on-premises and the cloudEnables various communication protocols and patterns for developers to engage in reliable messagingTopology doesn’t change
Enabling hybrid applicationsDatacenterPartnerLOB appMobile DeviceLOB web service
Enabling hybrid applicationsDatacenterPartnerACSLOB appSBMobile DeviceLOB web service
Enabling hybrid applicationsDatacenterPartnerACSLOB appSBMobile DeviceLOB web service
Enabling hybrid applicationsPartnerDatacenterACSLOB appSBMobile DeviceLOB web service
Enabling hybrid applicationsPartnerDatacenterACSLOB appSBMobile DeviceLOB web service
Electricity Power GridDemo
Don’t assume specific instancesVirtual IP : 1.1.1.2Virtual IP : 1.1.1.3Virtual IP : 1.1.1.4Worker RoleWorker RoleWeb RoleService Service IISInstanceInstanceWindows KernelWindows KernelWindows KernelTCP/IPTCP/IPTCP/IPTCP/IPTCP/IPNLB DriverNIC DriverNIC DriverNIC DriverVirtual NICVirtual NICVirtual NICVirtual IP : 1.1.1.1
Inter-role communications
Reduced Headache on  the one handNew challenges on the otherThere is one administrator
Azure MMC Snap-in http://code.msdn.microsoft.com/windowsazuremmc
Cerebrata – Azure Diagnostics Managerhttp://www.cerebrata.com/Products/AzureDiagnosticsManager/Default.aspx
Distribution cost in serialization, time on the wire, security Transport cost is zero
A lot of calls to fulfill a business function
Bring Data close to computation
It isn’t – but it’s abstractedunless of course you use Azure connectThe Network is homogenous Quickly connect on-premise computers with the cloud, no networking configuration requiredSupports standard IP protocols; secured using end-to-end IPSecIntegrated with the Windows Azure Service Model; all role types supported
Deployment viewConsider xsmall instances for developmentTest if you can use less than medium for production
Cost considerationsYou pay when you’re deployed (there is no “shelving”)Shutdown doesn’t help(keep CPUs running..)
2 Small instances cost the same as 1 medium instance
2 instances can give you better availabilityNeed to be on different fault and upgrade domains
I/O performance on smaller instances might be problematic
You can control Azure from scripts and code (even dev fabric)Testing
Demo Cloudoscope Acceptance Tests
IllustrationsSlide 11 http://www.sxc.hu/photo/1201443Slide  http://www.sxc.hu/photo/1160486

Things to think about while architecting azure solutions

Editor's Notes

  • #3 More than 30 years ago (1975)
  • #5 IEEE 1471 – recommended practice for architecture description of software intensive systemSoftware architecture is the collection of the fundamental decisions about a software product/solution designed to meet the project's quality attributes (i.e. requirements). The architecture includes the main components, their main attributes, and their collaboration (i.e. interactions and behavior) to meet the quality attributes. Architecture can and usually should be expressed in several levels of abstraction (depending on the project's size). If an architecture is to be intentional (rather than accidental), it should be communicated. Architecture is communicated from multiple viewpoints to cater the needs of the different stakeholders.Architectural decisions are global tied to quality attributesDesigns decisions are local –tied to functionality
  • #7 Fallacies of ditributed computingPeter Deutsch (first 7 in 94) & James Gosling (last in 97)
  • #10 Slide ObjectiveIntroduce idempotencySpeaking NotesWhen describing the function“F of X equals F of F of X” – More simply put You get the same result no matter how many time you call the functionThis is important for us in this situation as the approach that Windows Azure takes to queues;Read the message and hideDelete the message on completionIs vulnerable do executing the same message twice. The pattern guarantees that each message will be processed to completion AT LEAST onceNotes
  • #11 Slide ObjectiveUnderstand the need for idempotent operations with a simple exampleSpeaking NotesThere are number of reasons why you may not call deleteMessage, including:Your code failsThere is a hardware failure, effectively killing your worker role codeThere worker role is instructed to stop, and you have no code implemented to do that in a timely fashion.For this reason, you should design the tasks your worker role does to be Idempotent – which basically means that you should be able to do the same task twice, without it having an adverse effect on the system state.e.g. – If the worker is sent the name of a picture stored in blob storage that it would resize, it does not matter how many times it resizes the image, the outcome is the same. This is idempotent. If a worker is decrementing a balance, it DOES matter how many times this occurs – this is NOT idempotent.Notes
  • #12 Slide ObjectiveUnderstand a way to make the previous example idempotent- or at least robust against multiple message processingSpeaking NotesThe approach in this slide is to use a Replay LogThis allows us to track whether we have seen a message before and if so take a different course of actionThere will be various levels of remedial action we may choose to take based on the contents of our replay logWe may be able to fully compensate for the previous failureWe may need human interventionNotesSome good (older) posts on creating idempotent web services. Worth readinghttp://blogs.msdn.com/b/ramkoth/archive/2004/03/12/88423.aspxhttp://blogs.msdn.com/b/ramkoth/archive/2004/03/13/88778.aspxGood MSDN mag article that touches on the topicsAlso discusses MSMQ and WCF which have different approaches- are transactionalhttp://msdn.microsoft.com/en-us/magazine/cc663023.aspx Discussion on dealing with situations where processing time may inadvertently exceed the invisibility timeouthttp://blog.smarx.com/posts/deleting-windows-azure-queue-messages-handling-exceptions