Earlier this week in our Worldwide Partner Conference, we outlined our vision for the cloud and underscored Microsoft's commitment to providing a platform that enables our customers to embrace cloud computing fully. As part of this commitment, the opportunity for developers to build applications targeting the cloud has never been greater. Microsoft continues to provide common tools and frameworks, so developers can easily build applications in a consistent way, whether those applications will run in the cloud or on-premises.

One of the promises of the cloud for developers is using an application model built around services that can be elastically spread across an underlying "fabric". Building applications from services that are easily accessible from anywhere means developers can build applications "better, faster and cheaper", that are also resilient when failures occur, perform well, and scale easily, even when spikes and valleys in usage are not predictable.

Today you can get many of these benefits in your on-premises applications with Windows Server AppFabric.  Windows Server AppFabric, which was released in June, provides a set of capabilities focused on improving the performance and management of web and composite applications.  Windows Server AppFabric provides distributed caching technology and management and monitoring infrastructure using familiar .NET skills.

What Is It?

Windows Server AppFabric is application infrastructure for running and managing your services - infrastructure that you now don't have to write.  Windows Communication Foundation (WCF) provides a single programming model for creating services and communicating between them - it is the communications scaffolding around your service's application logic.  For long-running services and coordinated interactions across many services, AppFabric manages the lifetime and scaling of Windows Workflow Foundation (WF) workloads as well, since workflows in AppFabric are also services.  But that's just half the story.

The other half of the story is all about data caching.  It's fundamental to application design that you shouldn't repeat a computation that always returns the same result; do it once, store it, and deliver the result repeatedly instead.  This is true whether the result is a webpage, a query from your database, or a service call to an external component.  The Windows Server AppFabric Cache stores .NET objects, scales seamlessly, and manages data location and redundancy by distributing the cache across a cluster of machines.  The developer can simply put data in the cache and retrieve it when needed - AppFabric handles all the underlying complexity for you.

Fabric, Fabric, Fabric

You may have heard about other "fabrics".  The Windows Azure fabric controller is a feature of Windows Azure that manages physical and virtual machine resources as a shared pool for services. Then there is Windows Azure AppFabric, which is a cloud service that provides connectivity and federated identity, allowing you to build hybrid applications that run both in the cloud and on-premises. Although Windows Server AppFabric and Windows Azure AppFabric share the same name, they currently deliver different capabilities.  However, Microsoft's plan is to over time offer a symmetric set of capabilities across the cloud and the on-premises environments so that developers will be able to take advantage of these capabilities wherever they want to run their applications.

Installing Windows Server AppFabric

When you install AppFabric, you can choose to install the hosting capabilities, the caching capabilities, or both.  Installation is pretty simple: a developer workstation with IIS and Visual Studio (which installs SQLExpress) is all you need to get started.

You can install Windows Server AppFabric as a standalone download or from the Web Platform Installer (below).  After installation, you will be prompted to configure AppFabric's databases and security credentials.

AppFabric does its job mostly in the background, invisible to the user.  The visible face of AppFabric is the management and monitoring tools for your services that have been integrated into IIS Manager.  These tools drive the UI management experience for service hosting.  AppFabric services are integrated into the system management services such as perfmon and logging which can then be further integrated into a broader systems management infrastructure.

AppFabric Caching requires even less management; the "fabric" takes care of everything.  Adding new machines to the cache is handled in the AppFabric Configuration Wizard.  The cache takes a central configuration approach, so all the servers in the cache cluster know about each other.  You can choose to store this configuration in SQLServer or in a file share.   You add a new server by pointing at the configuration store and selecting to join a cluster:

Workflow and WCF Code Services

AppFabric manages both WCF services and Workflow Services (which are also WCF Services).  The difference lies in what's inside the service.  With WCF, it's your code.  With Workflow, you would typically have drawn your workflow using the Visual Studio Workflow Designer and a palette of re-usable workflow activities, including activities that allow you to make your workflow into a service and to call other services.

A workflow activity can also be thought of as a component and you can create new activities from existing ones - a composite activity.  This is a very powerful model for composing applications out of components and very useful in the cloud journey as well as in applications today. 

The Visual Studio WCF Workflow Service Application Template helps you get your workflow service up and running and see the results in AppFabric in just a few minutes.  To start, create a new project using the template and set the Web Property on the project to use the local IIS Server.  Build the project and run it.  The built-in WCF test client will launch, allowing you to send data to your workflow and see the result.  A similar template exists for WCF code based services, so you can immediately focus on your code based business logic and not have to write the WCF infrastructure or any of the related hosting and management capabilities that AppFabric now provides.

The AppFabric Dashboard

The AppFabric dashboard is the place in IIS Manager to see all the statistics about your code and workflow services.  The Workflow Instance History section shows the workflows that have activated and completed. The dashboard will also help you monitor and control workflow persistence.  For all services, calls are tracked and it is easy to create your own monitoring events and make these visible in the dashboard.

AppFabric tracks the execution of workflows from one activity to another and surfaces this information in the dashboard.  This is useful in troubleshooting issues and understanding the flow of execution for a given workflow instance.  You can even expose your data from within your workflows to AppFabric and query this data to find workflow instances that it contains.

Improving Your App's Performance with Caching

The Cache is a place to store data so that your applications can access it quickly.  The cache can be distributed across as many machines as you want, but the developer doesn't have to worry about which machine this data is on.  The cache can even be replicated onto the calling client (called a local cache) for super-fast performance but at the cost of consistency.  The data can be any serializable .NET object.

The point of the cache is to make your applications perform and scale better.  AppFabric supports both implicit and explicit cache use to achieve that improved scale and performance.  If you are an ASP.NET developer, implicit and explicit cache use will be familiar to you.  Explicit cache use is the ability to programmatically add, remove, and manage items in the cache through the cache APIs available in AppFabric.  This can be a very powerful tool in customizing your caching strategy to your application's data and usage patterns, but requires some understanding of data caching principles.  Implicit cache use takes advantage of default caching for common scenarios.  ASP.NET session state and HTML page caching (known as output caching) are two examples of implicit cache use.

The AppFabric cache really shines when you need to scale across more resources.  If you need more performance, simply add a new server and let AppFabric re-balance things automatically.  You can see this sort of linear scale in the image below.  As each server is added you can see the impact against the load - throughput increases and latency decreases.

Get Windows Server AppFabric

Windows Server AppFabric is now a part of the value you get in Windows Server 2008 for building high performance, resilient and scalable applications.  If you are running a Windows Server 2008 (SP2) or Windows Server 2008 R2, you are already licensed to use Windows Server AppFabric in production.  Additionally, if you are running Windows 7 or Windows Vista (SP2) you are already licensed for using Windows Server AppFabric in development.  There are no additional license fees.

You can download AppFabric and learn more from the AppFabric page.

Namaste!