PDC09 – Day Three – Building Scalable and Reliable Applications with Windows Azure

Brad Calder – Director/Architect

Data Building Blocks

  • Types of Storage in Windows Azure
    • Volatile Storage
      • Local Storage
      • Caches (eg. AppFabricCache and MemCache)
    • Persistent Storage
      • Windows Azure Storage
        • Blobs
          • Provide interface for storing name files
        • Tables
          • structured storage.
        • Queues
          • reliable storage and delivery of messages
      • SQL Azure
  • Storage Account Performance at commercial Availability
    • Capacity
      • 100TB
    • Throughput
      • Up to a few hundred megabytes
  • Partitioning of Data Objects
    • Load balancing is an internal concept of Windows Azure Storage
      • Allows the system to automatically scale out access to your data to meet its peek traffic demands
    • What matters to the application is the partitioning key used for objects
      • All objects with the same partition key are always grouped
  • Per Object/Partitioning Performance for Commercial Availability
    • Throughput
      • Single Queue and single table partition
        • Up to 500 transactions per second
      • Single Blob
        • small reads/writes up to 30 MB/s
        • large reads/writes up to 60 MB/s

Scaling Computation

  • Compute Service Model – What is describes?
    • The topology of your service
      • Types of roles and their binaries
      • How the roles are connected
    • Configuration of the service
      • How many instances of each role type
      • Application specific configuration settings
      • How many update domains you need
  • Best Practices
    • Due to application failures, upgrades or hardware failure
      • Use multiple instances
  • Queue Workflow Concepts
    • Windows Azure Queue Provides
      • Guarantee delivery
        1. Worker dequeues Message and marks it as Invisible
        2. Worker deletes Message when finished processing
        • Note: If worker role crashes, message becomes visible for another worker to process
      • A message may be processed more than once
      • Assume messages put into same queue can be processed in any order
    • Best Practice
      • Make work items idempotent
  • Scaling Queue Throughput
    • Batch Work Items into Blob
      • Group together many work items into a blob
      • Queue up pointer to the Blob for the message
    • Use Multiple Queues
      • Job Manager
        • Responsible form managing the execution of the Queues
      • Work Items
  • Continuation for Long Running Work Items
    • Want to continue on failover
    • High level approach
      • Bread work item into smaller and repeatable steps
      • Record progress

Lifecycle Management

  • In-place Rolling updates
    • Specify the number of upgrade domains in service model
      • Breaks your roles evenly over the number of domains
    • Rolling upgrade
      • Walk each upgrade domain one at a time
      • Upgrade just the roles in the current domain
    • Benefits
      • Minimizes availability loss
        • Only one domain of roles are restarted at a time
      • Allows local state to be uses across upgrades
      • Caches application upgrade issues early
        • Detect upgrade issues after first few domains
  • Versioning with Rolling Updates
    • Always assume you will have old and new running side by side in your service
    • Version Everything
      • Protocols, Schemas, Messages and everything else
  • Windows Azure Tables Schema change
    • Have a version property in each entity
    • Types of Schema changes
      • Adding a non-key property
        • Perform similar step update process
        • Update “IgnoreMissingProperties”
      • Removing a non-key property
        • Perform similar upgrade process
        • Update “IgnoreMissingProperties”
      • Changes in Partition Key or Row Key
    • Most uses schema change is adding a non-key property

PDC09 – Day Two – Advanced Topics for Building Large-Scale Applications with Microsoft Silverlight

MVVM – Model-View-ViewModel

  • Separation of concerns
  • View = handled UI
  • Model = contains pure data
  • ViewModel = communicates between View and Model through bindings
  • Works Great with Silverlight and WPF
    • XAML based data bindings
  • Testable

 

  • Model
    • Represents the Data
    • The entity
    • Not required to know where it gets the data from
      • WCF service, WCF Ria Services
  • View
    • The Screen, the UI
  • ViewModel
    • Main source of logic for the MVVM triad
    • Connects the Model and the View
    • Abstracts the View
    • Public Properties that are bound to the View
    • INotifyPropertyChanged and INotifyCollectionChanged talk to the view through bindings
    • Listens for changes from the View made to the Model
  • Variations of the MVVM
    • View First
      • ViewModel is declared as StaticResource in the Views XAML
        • Works well in Blend
      • Another way is to create the ViewModel in the View’s code-behind
    • ViewModel First
      • View is injected into the ViewModel’s constructor
      • Doesn’t allow the possibility to use Blend
    • View and ViewModel Marriage
      • View must be paired with the ViewModel somehow
      • Doesn’t allow the possibility to use Blend
  • What don’t we have with MVVM
    • Commanding

Prism 2

  • Prism is a set of options
  • Use what you want and ignore the rest
  • Technical Concepts:
    • Modules
    • Shell
    • Commands
    • Containers
    • Regions
    • Bootstrapper
    • Event Aggregation
    • Unity and Dependency Injection

PDC09 – Day Two – Windows Workflow Foundation 4.0 from the Inside out

Bob Schmidt – Program Manager

For WF4:

  • Programs are data
  • Scheduler-based program execution
    • stackless & serializable
  • Runtime-mediated code rendezvous
  • Natural Control flow
    • run it the way you think of it

Authoring

  • WF is an activity
    • Can author programmatically or using XAML
    • Can contain other activities
    • Separate base classes for activities that return a value
  • WF program is a definition from which many instances can be created
    • Each instance of an activity has a unique environment (visible data values)

Execution

  • WF runtime just sees activities and not sequence or parallel or recurrence
    • WF runtime is a referee that enforces the rules of the work
    • CacheMetadata is how an activity describes itself
  • WF runtime knows when an activity is done
  • An activity can schedule the execution of a child activity and be notified upon its completion
    • There can be multiple, distinct method invocations per activity
    • Can Express all kinds of patterns (control flow)
  • There can be multiple paths of invocation …

Scheduler

  • WorkItem represents the invocation of a method
  • WorkItems can be created by:
    • Activity Code
    • External Code
  • Flow of execution
    1. The Activity Code or the External Code Add a WorkflowItem
    2. Them the elements get Pushed or Enqueued for execution
    3. Afterwards the Scheduler will Pop it and execute it
  • Details
    • Scheduler per program instance
    • Manages an ordered list of work items

Threading Model

  • One thread at a time is used to process work items for a program instance
    • Simplifies the programming model of activities
    • Thread may differ work items in the same instance
      • WF runtime uses host-provided SynchronizationContext
      • Standard TLS mechanisms do not apply to WF
        • Instead use WF Execution Properties – names properties visible for a part of a workflow
        • Attached / detached from the current environment by the WF runtime before / after work item invocation
    • Activities should not block this thread

Bookmarks

  • Problems
    • What happens when your programs need to wait for input?
    • We want a “Zero footprint” WaitForInput()
  • Bookmark
    • A named resumption point in a WF program
    • Resumption will schedule an activity’s callback method
    • WF runtime mediates resumption – no need for the instance to be in memory
  • WCF Receive activity is built on top of bookmarks in order to give access to this possibility when using Workflow Services

Persistence

  • lets you pause an instance, save it somewhere & resume it later
    • has no affinity to a WF host instance, CLR instance, thread, process or machine
  • instances of WF are serializable
    • A CLR Stack is not serializable, but in WF program a stack only exists transiently, during work item execution
  • Sometimes you want a “no persist zone”
    • Automatic during execution of an async activity
  • Details of persistence are deliberately separate from the machinery of WF runtime

Serializable Instances

  • Contains
    • Work Item list
    • Bookmarks
    • Data (arg and values)
      • Environment for all executing activity instances
    • Activity instance info (callbacks, execution props)
    • Custom Data from persistence participants
  • Doesn’t contain
    • Workflow Definition
    • Why?
      • several instances can share the same workflow definition
      • management of definitions is responsibility of the host

PDC09 – Day Two – Developing Advanced Applications with Windows Azure

Steve Marx – Technology Strategist

Now we can have the ability to have more than a Web and a Work Role, since we have several different types of Roles.

Example:

  • IIS Role
  • SMTP Role

Now the there is the new Storage API that is currently being shipped with the SDK and not only a sample.

Some new features:

  • Inter-role communication
  • Non-Http endpoints
  • Role instance lifecycle
  • VM Sizes
  • Full-trust in the Cloud
  • Local Storage
    • Upgrading the local storage

How to model you application

  • Draw the boxes and arrows
  • Each box is a role
    • Which receive traffic from the internet
    • Which need IIS?

Receive Traffic: Input Endpoints

  • Different ports on same domain
  • There’s always load balancing
  • Declared in ServiceDefinition.csdef
  • Handled by IIS

InputEndpoint

  • Defined the protocol, port and name of the endpoint that will opened in order to listen for the requests
  • Protocols supported
    • Http
    • Https
    • Tcp

RoleEnvironment is the class that allow us to communicate with the Windows Azure fabric, for example in order to know the Configurations

Aside about Email

  • Spammers will use Windows Azure then the IP ranges can get blacklisted
    • Best Practices: Use a relay service in order not to have your mails marked as SPAM
  • Send mail via a rely mail
  • Receive mail is fine

Searching

  • Lucene.NET
    • Popular search API
    • .NET port of original Java implementation
  • Index data
    • Bring index up to speed on startup
    • Continually update index
  • Serve searched (via WCF)

Asynchronous Work without a Queue

  • Queues deliver messages to one worker only
  • We need every worker to see the message
    • Solution
      • use Table instead
        • Build your own secondary index
        • Order references

Initialization of Roles

  • Now we have:
    • OnStart() – “busy” state, initialization
    • Run() – do work
    • OnStop() – traffic stops, graceful shutdown

Internal Endpoints

  • Declare endpoints in ServiceDefinition.csdef
  • API to find out what port to listen on RoleEnvironment in Order to know if the port or anything change about the endpoint since the last call

How to Get More RAM

  • RAMDiectory pouts everything in memory
  • Choose the VM Size:
    • Small
    • Medium
    • Large
    • Extra-Large

PDC09 – Day Two – Keynote

Steven Sinofsky

Developing Windows 7

  • Learning
    • Solving Problems + Innovation
    • “Engineering 7” Blog made a very interesting Dialog even without having any code of the product, just about the decisions that were being made
    • Ecosystem Readiness
    • Developer Pre-Beta, Beta, RC rhythm
    • Telemetry
  • Telemetry
    • Seed Feedback Button
    • Hardware and Device Diagnostics
    • Reliability Analysis Component (RAC)
    • Software Quality Monitor (SQM)
    • Windows Error Reporting (WER or “Watson”)

Developing Internet Explorer

  • Learning
    • Responsible Engineering
    • Trustworthy computing
    • Real-world Interoperability
    • Innovative Technologies
  • Updates
    • Standards Progress
      • ACID
      • HTML 5
    • Performance Improvements
      • Javascript
    • Ecosystem Innovations
  • IE 9 with 3 weeks of development is looking interesting in terms of performance and interoperability
  • Using Direct2D and DirectWrite to provide better graphics rendering and Hardware Acceleration without any change of the current sites

Windows 7 Call to Action

  • Integrate with Windows 7 Desktop
  • Develop 64-bit
  • Focus on fundamentals in your code
  • Build on new APIs in Windows 7
  • Watch more videos today on Channel 9 about Internet Explorer 9

Scott Guthrie – Developer Division

Silverlight 4

  • Focus
    • Media
      • Web and and Microphones
        • gives you access to the raw access to the input and so you can make the changes you want on that stream, like using PixelShader with it
      • Multicast streaming
      • Output protection
      • Offline DRM support
    • Business Applications
      • Printing
        • Print Preview Dialogs
        • Printing Configurations
        • This is a Print API that you can change however you want and not only a screenshot of the screen
      • Rich Text
      • Clipboard access
        • Local and Central clipboard support
      • Right Click
      • Mouse Wheel
      • Implicit Styles
      • Drag and  Drop
      • Drop Targets support
      • Bidi & RTL
      • HTML
        • Hosting HTML inside Silverlight application
        • We can interact with the HTML contents as being a brush
      • Commanding and MVVM
      • Data & Networking
        • Sharing Assemblies across SL and .NET 4.0
        • Data Binding Improvements
        • UDP Multicast support
        • REST Enhancements
        • WCF Improvements
          • Main one is TCP channel support
        • WCF RIA Services
          • All the capabilities of RIA Services and with all the capabilities of WCF
          • Works well with OAuth
      • Visual Studio 2010
        • WYSIWYG Design Surface
        • XAML Intellisense
        • WF and POCO Support
    • Additional Control
    • Beyond the Browser
      • Windowing API
      • Notification Popups
      • HTML support
      • Drop Target support
      • Opening the Sandbox
        • Trusted Application
          • Custom Windows Chrome
          • Local File System
          • Cross-file Network
          • Keyboard support in Full Screen Mode
          • COM object support in Windows
            • using dynamic keyword of C#
          • Access to Several devices form the client machine
      • Silverlight Performance
        • Twice as fast
          • uses JIT like the normal .NET Application
        • 30% faster startup
        • New Profiling support
      • Google Chrome will support SL4 also
    • Schedule
      • Beta
        • All the features seen today
        • VS2010 Tools
        • Expression Tools
      • RC
      • Final Release
        • First half of Next Year (MIX’10 ????)

 

Kurt DelBene – Office and Sharepoint 2010

Microsoft Business Productivity Infrastructure

  • Unified Business Platform
    • Unified Communications
    • Business Intelligence
    • Enterprise Content Management
    • Collaboration
    • Enterprise Search

 

  • Office and Sharepoint Development Platforms
    • User Experience
      • Based in Services and in a Object Model that can be extended in order to create better User Experience
    • Application Services
      • Expose all the capabilities in the Applications as services to be consumed without loosing any of the features that we have access inside the solution
    • Content and Data Management
    • Interoperability with LOB integration
      • possibility to more easily integrate the external LOB applications inside the products
    • Tools and Deployment Flexibility
      • New Tools for Sharepoint Development
      • Debug capabilities are currently in the Tools
        • Now Debug really works. Awesome.
      • Interesting capability to import a Sharepoint solution to start the project
      • Possibility to deploy the solution in a sandboxed solution. Interesting in terms of security
      • Deployment
        • Simply upload the package generated by Visual Studio 2010 into the sharepoint – Real All-in-One working for deployment also. Now it looks really good for Sharepoint Development.
    • Announcing the Office and Sharepoint 2010 Public Beta to download www.microsoft.com/2010
      • Office 2010
      • Sharepoint Server
      • Project Server 2010
      • Visio 2010
      • Mobile is also available today in the mobile marketplace
    • Sharepoint has a Silverlight WebPart out of the Box.
    • Sharepoint 2010 now has the Office Ribbon

  • Announcing Duet Enterprise for Microsoft Sharepoint and SAP
    • Consume and extend SAP from Microsoft Sharepoint 2010
    • Available on the Second-half of 2010
  • Announcing the Outlook Social Connector
    • Windows Live, Sharepoint Server, Linkedin
    • Has an Open SDK that can be used to develop new connectors for this connector