.NET Framework 4.0 facilitates creation of Workflow services – with WCF acts as the communications scaffolding and WF4 used to implement service as long running, durable business process with coordinated interactions.. Can Developers then spend more time on business logic and less building infrastructure? This requirement is met by Windows Server AppFabric. This session explains the key features of AppFabric in providing infrastructure to improve the hosting, persistence, performance, scalability, and manageability of Workflow Services.
6. Workflow Services in .NET 4
Workflow Service Host Management
Endpoint
Persistence Persistence
Activity Library Behavior (Instances)
Receive
Send
Tracking
... Behavior Monitoring
Not Easy to get
Configuration Monitoring
How to
& Hosting
started! instrument?
(DB based)
App Server Support
Performance,
– Out of the Box Persistence,
!
Dashboard + - Abilities???
*Availability,
How to script?
Scripting Reliability
Support
7. Challenges Using WF And WCF Today
• “I want to get my WF and WCF services up and
running easily - Why doesn’t it just work?”
• “It is difficult to monitor and
control running WF and WCF services.”
• “I wish I had easy to use tools and scripting
support.”
• “How do I make my services
enterprise-ready? ” – RSP:
Reliability, Scalability, Performance
8. Requirements
• Out of the Box, Centralized support for Server
App
– Service Hosting Support out of
the box!
– Managing Instances
– Scaling out Distributed Applications
– Scripting management tasks
– Easier Troubleshooting
– Distributed caching
9. Agenda
• Why Windows Server AppFabric?
– A Developer’s viewpoint
• AppFabric
– Architecture
– Hosting
– Persistence
– Monitoring
– Caching
• How Appfabric handles the ‘abilities’
10. Windows Server AppFabric
Management Tools
IIS Manager Modules
PowerShell
Services Workflows
Persistence Hosting Monitoring Caching
Windows Server
Windows Server AppFabric
.NET Framework
Persistence Runtime Databases Monitoring
IIS/WAS
12. Agenda
• Why Windows Server AppFabric?
– A Developer’s viewpoint
• AppFabric
– Architecture
– Hosting
– Persistence
– Monitoring
– Caching
• How Appfabric handles the ‘abilities’
13. Hosting
• Auto-Start of a Service
– Reduce latency for first message
– Service initialized before the first call
– Hosting protocols for which there are no Listener
Adapters
• Scenarios
– Computer re-start
– Protocols like WS-Discovery announcement require
applications to be always available
– Connect to a DB, read hundreds of rows of data,
populate cache on creation
17. Agenda
• Why Windows Server AppFabric?
– A Developer’s viewpoint
• AppFabric
– Architecture
– Hosting
– Persistence
– Monitoring
– Caching
• How Appfabric handles the ‘abilities’
18. Persistence
Workflow Service
Management
Endpoint
Windows Server AppFabric
Workflow
Management
Service
Instance
123 | data
456 | data
789 | data
011 | data
Persistence
DB
19. Scenarios
• Workflow waits for some external stimulus
• Workflow has explicit Delay planned
• Workflow has asynchronous tasks, requires
correlation support
• Workflow instance should be re-activated if
the host crashes
– Same m/c or different machine
• Failed Instances should be recoverable, if
possible
20. Scenarios
• Persist before Replying
• Waiting
• m/c or host crash
• Instance aborted ,
recoverable
21. Asynchronous Operations
• One way operations using correlation provides
simple async messaging infrastructure
Workflow
Other
Send Service
Id = 42
Do Work
Do Work
Do Work
Receive Id = 42 Calls Back
22. create correlation
1. Add item (userId 3) 2. Save (userId 3)
Receive
Persistence DB
(Instances)
3. View items (userId 3) 4. Load (userId 3)
Receive Instance Key
123 | data 123 | userid 1
5. Best Price (userId 3) 6. Load (userId 3) 456 | data 456 | userid 2
Receive 789 | data
789 | data 789 | userid 3
789 | userid 3
A11 | data A11 | userid4
23. Instance Recovery & Control
1
5
Workflow Management
Workflow Service Host
Service
AppFabric
SQL Instance Store
3
App Domain 4
2
instance
Host Crash SQL
M/c Crash Persistence
Unhandled Exception Database
– WF Instance aborted
24. What you need to do
• Decide how many Persistence Stores are
required
• Check whether SQL based Instance Store is
required/ will suffice
– Create a Custom Persistence participant if
required
• Configure Persistence and Instance Control in
AppFabric
26. Agenda
• Why Windows Server AppFabric?
– A Developer’s viewpoint
• AppFabric
– Architecture
– Hosting
– Persistence
– Monitoring
– Caching
• How Appfabric handles the ‘abilities’
27. Monitoring
• Visibility into the operation of services
• Scenarios
• Health monitoring – “How well is my app
running?”
• Troubleshooting – “What has failed with my app?”
• For every approver, track the time taken , approval
status
• How long does the credit appraisal workflow take
to complete?
28. Monitoring
Workflow Service
ETW
Monitoring Tools
WCF
Trace
Tracking
Participant
Windows Server AppFabric
Event Collector Monitoring
Tracking Service Database
Profile
29. What You can do?
• Decide Monitoring level
• Define a Tracking Profile for your service
• Create Custom Tracking Records
• Decide variables and arguments to track
• Use promoted properties to collect business
data
31. Agenda
• Why Windows Server AppFabric?
– A Developer’s viewpoint
• AppFabric
– Architecture
– Hosting
– Persistence
– Monitoring
– Caching
• How Appfabric handles the ‘abilities’
32. What is AppFabric Caching?
• An explicit, distributed, in-memory application cache for all kinds
of data
– (CLR objects, rows, XML, Binary data etc.)
– Fuse "memory" across machines into a unified cache
Caching clients can
be across machines
or processes, can
maintain local
cache
Clients Access
the Cache as if it
Unified Cache View was a large
single cache
Cache Layer
distributes data
across the
various cache
nodes
33. App caching Features
• Simple Access Patterns – Get/Add/Put/Remove
• Tag Searching
• Partitioned & Local Client Cache
• High Availability
• Multiple Concurrency Control Options
• ASP.Net Integration
• Management & Monitoring
• Security
• Cache Event Notifications
34. Classify Your Data
• Reference Data - unchanging, accessed by
multiple clients
• Activity data - changing, accessed by a single
client
• Resource Data – changing, accessed by
multiple clients
35. Examine Requirements
• Is latency critical?
• Is the data secured?
• Is the data evictable?
• Can Staleness of Data be tolerated?
• Should cached data survive m/c failures?
36. Agenda
• Why Windows Server AppFabric?
– A Developer’s viewpoint
• AppFabric
– Architecture
– Hosting
– Persistence
– Monitoring
– Caching
• How Appfabric handles the ‘abilities’
37. Windows Server AppFabric
Startup Management Tools
Performance – IIS Manager Modules
PowerShell
Auto Start
Services Workflows
Persistence
Persistence Hosting
Hosting Monitoring Caching
Caching
Windows ServerWindows Server AppFabric
.NET Framework
Persistence Runtime Databases Monitoring
IIS/WAS
Performance – Speed of Access
Scalability – Cache Cluster,
Reliability – Long Running WF Business Logic in multiple m/cs
Availability - Recovery from crash Availability – Copies of Cache
Scalability – M/c Agnostic WF
39. Scaling a Workflow Service
AppFabric
Web Server Hosting
Services
ASP.NET 2) Invoke
3) Persist
1) Make first workflow
Pages workflow
request to service
state after
application handling
Web Server request
ASP.NET Persistence
AppFabric Store
Pages
Hosting
4) Make second Services
request to
Web Server 6) Load workflow
state and handle
application request
ASP.NET
Pages 5) Invoke
workflow
service
40. Caching with High Availability
Cache Cluster
Cache Server
AppFabric Caching
3) Return value Services
of data item X
Cache Client from secondary X
copy
Cached Data
Cache Server
2) Access AppFabric Caching 1) Cache server
data item X Services holding primary
copy of data item X
X fails or is shut
Cached Data down
Primary copies
Secondary copies
41. The Complete Picture
Cache Cluster AppFabric
Caching
Services
Cache requests
spread across
Web cache servers
User requests Server
spread across
Web servers
AppFabric
Hosting
Services
Service requests
spread across
middle-tier
servers
42. Summary
• Life made easy for Developers of WCF and
Workflow Services with Windows Server
AppFabric
• Out of the Box Support for
– Hosting WCF and Workflow Services
– Configuration
– Tool Support
– Persistence
– Monitoring
– Caching
– Enterprise Capabilities
43. System Internals:
Durable Timer for Workflows
Workflow
1 4
Management
Delay
Service
Workflow Service Host
SQL Instance Store
AppFabric
2 3
SQL
Persistence
Database
44. Instance Activation
4. Activate
App
Service Activation Endpoint
WMS
SMS
5.Activates 1.Create &
Subscribe 3. Raised
Workflow Service Host for Event Event
8.Load Instance Store
6.Creates
instance
Instance Store SQL WF Instance Store
SQL WF Instance Store
2. Activatable
Instance Store Tables Notification
7. Loads
Instance State Persistence DB
45. Command Activation
App
Windows Service host 4.Command
WMS
Instance Control
Endpoint
1. Create
Instance Store 3.Command
SQL WF Instance Store
SQL Instance Store Control
Provider
2.Dequeue
Instance SQL Control 2. Enqueue Command Queue
Control Provider
PowerShell Persistence DB
46. Instance Recovery
1
5
Workflow Management
Workflow Service Host
Service
AppFabric
SQL Instance Store
3
App Domain 4
2
instance
SQL
Persistence
Database
47. AppFabric Caching API
// Create instance of cachefactory (reads appconfig)
DataCacheFactory fac = new DataCacheFactory();
// Get a named cache from the factory
DataCache catalog = fac.GetCache("catalogcache");
// Simple Get/Put
catalog.Put("toy-101", new Toy("Puzzle", .,.));
// From the same or a different client
Toy toyObj = (Toy)catalog.Get("toy-101");
// Region based Get/Put
catalog.CreateRegion("toyRegion");
// Both toy and toyparts are put in the same region
catalog.Put("toy-101", new Toy( .,.), “toyRegion”);
Catalog.Put("toypart-100", new ToyParts(…), “toyRegion”);
Toy toyObj = (Toy)catalog.Get("toy-101“,"toyRegion");
48. AppFabric Caching Logical Hierarchy
AppFabric AppFabric AppFabric AppFabric
Caching Caching Caching Caching
Service Service Service Service
Named Cache : Product Catalog
Named Cache : Electronics Inventory
Key Payload Tags
Region A 121 xxxx “Toy” “Child”
123 yyyy “Toy” “Chair”..
Regions
Machine -> Cache Host -> Named Caches -> Regions -> Cache Items -> Objects
• Host • Cache Item
– Physical processes hosting – Key, Payload (Object ), Tags, TTL,
AppFabric Caching instance. Timestamps, Version
• Named Caches • Regions
– Can span across machines – Physically co-located Container of
– Defined in the configuration file Cache Items
– May be implicit or explicitly created