Today at PDC we are excited to introduce the Windows Server AppFabric Beta 1. AppFabric evolves the existing application server capabilities of Windows Server to make it easier to build, scale and manage Web and composite applications that run on Internet Information Services (IIS).
For Web applications, AppFabric provides caching capabilities to provide high-speed access, scale, and high availability to application data These capabilities are based on the technology previously code named “Velocity.”
For composite applications, AppFabric makes it easier to build and manage services built using Windows Workflow Foundation (WF) and Windows Communication Foundation (WCF). These capabilities are based on the technology previously code named “Dublin.”
This first post provides an introduction to developing and managing WF services with AppFabric. Download the Beta 1 release at http://msdn.microsoft.com/appfabric.
Introduction to AppFabric
The benefits of having service-based applications, often referred to as SOA, to create systems based on autonomous services have been articulated in several MSDN articles. WCF is the technology that enables this, and in turn has been integrated with other Microsoft developer technologies such as ADO.NET Data Services, WCF rich Internet applications (RIA) services and WCF REST services. In .NET Framework 4, WCF has been deeply integrated with an improved WF runtime enabling you to build WCF services that are implemented with WF.
Whatever technology that you use to build and compose services together, you face challenges based on these questions:. “When building server applications what features of the platform can I take advantage of that light up my application and enable me to focus more on the business?” “Having built this application, where is the best place to test this, to run this in production, and how do I manage it?”
This post focuses on how Windows Server AppFabric, combined with the .NET Framework 4, addresses these challenges, with particular emphasis on WF services.
Developing WF Services
Depending on the architecture of your application, typically you build services focused on the middle tier. For example, ADO.NET Data Services are suited for the data access tier and can be composed together with other services in the middle tier. For an overview of WF services in .NET 4, read the Aaron’s overview of WCF in .NET 4 on MSDN. In the middle tier, WF services are an ideal technology, since they are strongly focused on using declarative approaches for composing services for your business. For additional reading on WCF Services, David Chappell’s ’The Workflow Way’ provides an excellent introduction to the topic.
The key values that WF Services bring to service authoring are:
- Long-running applications that wait for external input for activation such as messages, thereby using resources efficiently.
- A single or sequential flow control programming model while handling the complexity of multiple async I/O calls. For example, by using a parallel activity in your WF Service you can coordinate multiple calls to other services allowing the WF runtime to take care of all the async message calls and marshaling the data back to your service.
- Coordination of messages to workflow instances with the use of message correlation. WF Services in .NET Framework 4 provide content-based correlation that enables you to query the content of a message for unique information to identify the specific workflow instance the message relates to. This enables long-running scenarios being able to activate a specific workflow instance when clients send messages.
- Consistent WCF and WF instrumentation integrated with Event Tracing for Windows (ETW). The WCF and WF runtimes now both emit ETW events for tracing and tracking to provide detailed monitoring and diagnostics. Using ETW provides greater performance, thereby having less impact on your applications.
- An expressive set of workflow activities for authoring business process. Here the Flowchart activity is extremely powerful by enabling you to more closely match the typically graphical representation of a business process drawn using Visio, for example, with the implementation of the business in code using the Flowchart.
- A simple extensibility model for workflow activities, enabling you to define your own library of business domain activities. These can be included into the Workflow Designer in Visual Studio 2010, enabling developers to more quickly build business WF services.
Hosting and Managing Services
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.
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.
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, 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.
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.
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.
You can download Visual Studio 2010 Beta 2 from the Visual Studio 2010 page on MSDN.
You can download Windows Server AppFabric Beta 1 from AppFabric page on MSDN.