Hosting and Managing Services with AppFabric
Regardless of the technology used to build your service, where and how you run your services introduces a number of options. Today you can host your services in a process created by the Windows Process Activation service (WAS) in IIS, a Windows service or a self-hosted executable. This provides a mechanism for activating workflows, but is only one part of a broader hosting picture for providing a suitable environment to run your production applications. Typically there are other platform service requirements that as a developer you would like to take advantage of, such as application state storage (persistence), instrumentation for health monitoring, caching, and other capabilities that provide scalability and reliability to deployed applications. Windows Server as an application server today provides services you can take advantage of such as MSMQ for message queuing, and the event log for diagnostics.
Windows Server AppFabric builds on the application server capabilities in Windows Server to 1) host and manage your WCF and WF Services and 2) provide a distributed in-memory data cache. AppFabric provides a set of common services that your applications can take advantage of thereby allowing you as a developer to concentrate on building solutions that solve key business problems. These common services are focused on enhancing Windows Server’s WCF and WF Service hosting capabilities, and making it easier to manage these services. Additionally the distributed cache introduces rich scale-out capabilities for applications built using .NET Framework.
Persisting WF Services
The key scenarios this enables are;
- Reliability – The ability to persist (save) workflow state and reliably resume workflow instances that have been idle for a defined time interval.
- Availability – The recovery of saved workflow state when an application, process, or computer terminates unexpectedly.
- Scalability – The ability to unload idle workflow instances from memory to efficiently use resources, the capability of retrying to load workflow instances when a message arrives on a different computer in the host farm, and gracefully handling retries when there is a lock on the instance.
Windows Server AppFabric provides a Windows service called the Workflow Management service (WMS) that manages instances in the persistence store. AppFabric can install a SQL Server persistence store for your WF Services which the WMS monitors to enable the scenarios above. AppFabric also supports other store solutions as well.
Monitoring
The key scenarios this enables are;
- Health monitoring – How well is my app running? The ability to see expected healthy events occur within your service to know that it is still operational.
- Troubleshooting – What has failed with my app? The ability to quickly diagnose failures within your service and either correct these or provide a developer with further detailed information.
Windows Server AppFabric provides a Windows service called the Event Collector service that captures health and failure events from your services and writes these to a SQL Server monitoring store, or another store built to leverage the pluggable AppFabric monitoring solution. This provides analytical data about your applications. You can either take advantage of rich UI tooling integrated into IIS Manager to view these events in the monitoring store, or build your own reporting using SQL Server Reporting Services or another data analysis solution, to view this data.
Process Hosting
The key scenarios this enables are:
- Efficiently using computer resources by hosting services in the Windows Process Activation Service (WAS) in IIS. IIS and the WF runtime are deeply integrated. For example, if IIS decides to recycle a process due to memory constrains it will communicate with the WF Service to ensure that a graceful shutdown occurs, thereby allowing the service to be restarted in another process or on another computer by the WMS.
- Auto-start to “warm-up” services hosted in IIS. When the computer starts, or when IIS starts, services can be pre-warmed, thereby reducing the latency on the first message.
By integrating the WF runtime deeply with the IIS/WAS process activation model, WF Services are ideally suited to being hosted in IIS/WAS and benefit from the rich hosting capabilities that IIS/WAS provide.
Distributed Caching
Distributed, service-oriented applications often require support for a large number of users, and high performance, throughput, and short response time. Services are increasingly moving “far away” from their underlying data stores and in many cases those data stores are “expensive” to access due to both technical and licensing costs. As a result, developers are increasingly forced to find alternatives to continually accessing the physical data store and often turn to caching to meet these challenges.
Windows Server AppFabric provides a distributed, in-memory, application cache for developing scalable, available, and high-performance applications. The caching capabilities fuse memory across multiple computers to give applications a single unified cache view that can be easily scaled-out by simply adding more computers on demand.
Some key caching features provided by Windows Server AppFabric include:
- Caching any serializable CLR object and providing access through simple cache APIs
- Enterprise scale: tens to hundreds of computers
- Configurable to run as a service accessed over the network
- Dynamic scale-out by adding new nodes
- High availability through backup copies
- Automatic load-balancing
- Seamless integration with ASP.NET with an ASP.NET Session State Provider (better perf and scale and no more sticky routing!)
- Integration with administration and monitoring tools such as Windows PowerShell, Event Tracing for Windows, and System Center.
Tooling
The tooling support for services in Windows Server AppFabric will be covered in more detail by future posts. Integrating tooling into IIS Manager provides a familiar management, control, and monitoring experience for the IT professional managing applications in a production environment or the developer troubleshooting deployed applications. In addition, AppFabric provides an extensive set of Windows PowerShell commands to enable you to script the capabilities in the UI.
Summary
This post describes the key benefits of building WF Services with Visual Studio 2010 and .NET Framework 4, and the benefits of hosting these in Windows Server and managing and scaling them with AppFabric.
The deep integration of WCF and WF provides an intuitive approach for developing declarative WF Services. WF Services make it possible to build long-running services that take advantage of the service coordination support provided by the workflow runtime, enabling you to use workflow to solve key business problems.
Windows Server AppFabric adds improved hosting capabilities to Windows Server to efficiently host all your WCF services, including WF Services. Additionally, AppFabric provides common services that help you as a developer build scalable Web and composite applications.