Friday 2 July 2010

What is AppFabric?

Here are some brief introductory notes on the AppFabric platform. According to the Microsoft AppFabric site:
“Windows Server AppFabric is a set of integrated technologies that make it easier to build, scale and manage Web and composite applications that run on IIS.”
AppFabric provides 2 core services which can be used independently or together:
  • AppFabric Caching Services, which can speed up access to frequently accessed information such as session data used by an ASP.NET application.
  • AppFabric Hosting Services, making it easier to run and manage services created with Windows Communication Foundation, especially those built using Windows Workflow Foundation.
AppFabric is provided as extensions to the Application Server role of Windows Server.

AppFabric caching services

The original codename for AppFabric Caching Services was Velocity. AppFabric Caching Services speeds up access to frequently accessed data.
The main components of AppFabric Caching Services are:
  • A cache client - accesses a cache cluster containing some number of cache server machines.
    • e.g. an ASP.Net page.
  • Cache server(s) - running instances of AppFabric Caching Services and maintaining cached data.
    • All the cache servers in the cluster appear as a single logical store.
    • The client neither knows nor cares which physical server winds up holding the cached data.
  • Cache client local cache – also using services provided by AppFabric Caching Services.
When a cache client acquires data it can use the AppFabric Caching Services client library to store the data in the cache cluster under a unique name. When the client needs the same data again, it asks for it using the item’s name:
  • The query first checks the local cache (if one is being used).
  • If the data is found the client uses the cached value.
  • If the data item isn’t in the local cache the query is sent to the cache cluster.
  • If the data is found the client uses the value returned from the cluster.
  • If the data isn’t found the client needs to look elsewhere for the information (e.g. the database).
A cached data item can be any serialized .NET object.
All cached data is stored in memory. By default, cached data is only stored on one node in the cluster but AppFabric Caching Services also has a high-availability option that creates a secondary copy of each cached data item on another node in the cluster.
Cached data items can be removed from the cache by client applications or by the caching service itself (e.g. through expiration based on a configurable time-out period or by being evicted to make room for more frequently accessed information). This applies to local caches as well as the server caches. Local caches can can be set to synchronize automatically with changes to data items in the cache cluster.
Data sent between cache clients and cache servers can be digitally signed and encrypted. Administrators can limit which accounts have access to each cache.
Note that AppFabric Caching Services have built-in support for storing ASP.Net session data.

AppFabric Hosting Services

The original codename for AppFabric Hosting Services was Dublin. WCF and WF services need service hosts and AppFabric Hosting Services provide some infrastructure for hosting in IIS.
AppFabric Hosting Services build on what’s already provided by IIS and Windows Process Activation Service (WAS), adding additional capabilities for running and managing WCF services, including workflow (WF).
WCF services and WF services run in worker processes provided by IIS - AppFabric Hosting Services doesn’t provide its own host process.
AppFabric Hosting Services extends the IIS Manager and provides facilities which include:
  • Setting WCF configurations
  • Starting and stopping services
  • Examining service endpoints
  • Suspending, resuming, or terminating specific instances of workflow services
  • An IIS manager dashboard for monitoring WCF and WF services
AppFabric Hosting Services also provide PowerShell ‘commandlets’ for service management.
Visual Studio WCF and WF projects created with the built-in project templates are immediately deployable in AppFabric Hosting Services.
The WF runtime automatically persists the state of a workflow that’s waiting for input, then rehydrates it when input arrives. Using WF by itself the developer must create and configure a persistence database. However, AppFabric Hosting Services provides a pre-configured persistence store.
WF allows a workflow’s execution to be tracked giving the developer a detailed record of its execution with the tracking data being stored in a monitoring database. Conventionally the WF developer must supply a monitoring database but AppFabric Hosting Services provides a built-in monitoring database for this purpose.
AppFabric Hosting Services allows a service to be deployed to a load-balances server environment so that workflow etc. is coordinated across multiple servers in the cluster. AppFabric Hosting Services lets the same instance of a workflow service execute on different machines at different times (i.e. it makes the service more scalable).