Windows Server AppFabric

advertisement
GLOBALLOGIC
Windows Server
AppFabric
Hosting features for WCF services
Pallav Kumar
2/22/2013
Windows Server AppFabric is a set of extensions for Windows Server that includes caching and hosting
services for services based on Windows Communication Foundation (WCF) and Windows Workflow
Foundation (WF). This manuscript talks about the Hosting features provided by AppFabric for WCF
services.
WHAT
AppFabric is a set of middleware technologies for Windows Server, released by Microsoft. It consists of
two main feature areas:
 AppFabric Hosting
 AppFabric Caching
AppFabric also integrates with Internet Information Services (IIS) providing management and monitoring
tools within the IIS management console.
We can employ AppFabric to facilitate the management of WCF services.
For WCF, the AppFabric Hosting feature provides two main capabilities:
 Hosting - add service management extensions to Internet Information Services (IIS), Windows
Process Activation Service (WAS), and the .NET Framework 4.
 Monitoring - Monitoring stores and correlates service events in a backend database. This
facilitates analysis and troubleshooting of the coordination of multiple WCF services
The tooling for services hosted in AppFabric allows you to monitor your applications and to manage
security, auto-start activation, performance, and service endpoints. The AppFabric hosting services
provide hierarchical management using inheritance of configuration files, so you don’t need to access
the files directly.
WHERE
We install AppFabric on web-server, which host the WCF services and serve the requests from the
clients.
WHEN
It is useful when we need to know:





Which WCF services are hosted?
What are the endpoints exposed?
Which operations of WCF are frequently called?
Which operation of WCF service is taking how much time?
How many Exceptions, Faults occurred?
In IIS, there is separate section for AppFabric.
AppFabric Dashboard – For WCF services, it gives you details of Completed Calls, errors, exceptions
and throttle hits. You can drill down to the Tracked Events section to view the further details.
Endpoints – Help you to manage configured endpoints.
Services – View and Configure WCF services.
HOW
The AppFabric runtime component uses Event Collection service to capture the ETW events emitted by
WCF service and writes it to a single staging table in the monitoring database. A SQL Agent job
continuously runs and checks for new event records in the staging table, parses the event data, and
moves it to the long-term storage WCF. Data is displayed on dashboard.
WHY
The hosting features of AppFabric for WCF services have following advantages/disadvantages.
Advantages:



Only for Win2008 Enterprise licenses
Highly configurable
It’s supported my Microsoft (not open source)
Disadvantages:


Its only run with windows 2008 R2 (does not run on Windows Server 2003)
It requires at least as much work to setup as other solutions (which isn’t much work for very
basic operations)
Value Addition:
AppFabric adds direct value monitoring service activity and errors, providing 5 different scenario based
levels of logging, including custom.
Windows Server AppFabric, you can choose five monitoring levels:





Off has the same effect as disabling monitoring and is best used in scenarios that need minimal
tracking overhead.
Error Only gives visibility to only critical events like errors and warnings. This mode is best for
high-performance scenarios that need only minimal error logging.
Health Monitoring is the default monitoring level and contains all the data captured at the
Errors Only level, plus some additional processing data.
End-to-End Monitoring contains all data from level Health Monitoring plus additional
information to reconstruct the entire message flow. This is used in scenarios where a service
calls another service.
Troubleshooting, as the name suggests, is the most verbose level and is useful in scenarios
where an application is in an unhealthy state and needs to be fixed.
Architecture Diagram
The following architectural diagram shows the parts of AppFabric as well as the .NET Framework 4 and
IIS components that are used by AppFabric:
AppFabric Dashboard - WCF Call History
The WCF Call History section displays historical statistics derived from WCF call events stored in one or more
Monitoring databases. The displayed values are summaries of historical data from all the databases included in the
current scope. If the current scope includes services that are configured to use different monitoring databases,
then the values shown in the WCF Call History section include data contributed by all the databases in scope.
This section displays a summary of WCF call history for .NET Framework WCF services that have monitoring
enabled. It provides a summary of all WCF Completed Calls, Errors, and Throttle Hits within the time frame
selected in the Time Period drop-down list. Clicking any of these summary links takes you to the corresponding
Tracked Events Page with query result data specific to the originating category. Expanding the WCF Call History
section displays the top five services with the most WCF Completed Calls and WCF Service Exceptions. It also
provides a breakdown of Errors by Service Exceptions (mostly caused by Failed or Faulted Calls) and User Defined
Errors.
Summary Metrics
The following table describes the summary metrics for WCF Call History.
Summary
Description
Metric
Completed
Total number of calls completed in the selected time period.
Throttle Hits
Total number of throttle hits that occurred in the selected time period.
Errors
When one of the main service throttle counters (MaxConcurrentCalls, MaxConcurrentInstances,
or MaxConcurrentSessions) have been initially exceeded, the 201: MessageThrottleExceeded
event is emitted. When the spike of activity slows so that the current value of the throttle is at 70
percent of the current limit then a 224: MessageThrottleAtSeventyPercent event is emitted. This
event is only emitted one time as the throttling activity is slowing down. If the current value
averages around the 70 percent mark (e.g. 70, 69, 70, 71, 70, 69) only the first dip to 70 percent
results in an event. After this event is emitted, any future occurrences of exceeding the throttle's
limit will result in another emission of a 201: MessageThrottleExceeded event.
Total number of errors that occurred in the selected time period.
Expanded Area Metrics The following table describes the expanded area metrics displayed in the columns in the expanded area. For the
Completed Calls and the Service Exceptions EAM columns, the top five service instances for those categories are
displayed in descending order. These two columns show the top five services with the highest number of calls or
exceptions over the selected time period. For the Errors – Grouped by common types EAM column the data is
shown associated with a service exception.
Metric
Completed Calls,
Grouped by Service
Display Value
Service virtual path and Web site, count of WCF calls. Displays the top five services in
descending order with instances with the most completed WCF calls.
(top 5)
Errors - Grouped
by common types
Displays a breakdown of the number of errors by Service Exceptions and User Defined
Errors. Service Exceptions are broken down by the common causes of Calls Failed and Calls
Faulted. Additional issues, such as activation issues, can also contribute to the number of
Service Exceptions which are not displayed in the breakdown of Service Exceptions.
Service virtual path and Web site, count of WCF calls. Displays the top five services in
descending order with instances with the most WCF service exceptions.
Service Exceptions,
Grouped by Service
(top 5)
You can click on a count to open the Tracked Events Page to obtain more detailed information. A filter is
automatically applied to show calls related to the service you clicked.
Configuration
1. Install Windows Server Application Fabric on the web-server.
2. Open ConfigureFabric from the program menu.
a. In the Hosting service section, check the Set monitoring configuration checkbox. & add
Event Collector service account. Set the Monitoring provider.
b. Skip the caching section.
c. In application section check the Start IIS manager checkbox.
3. In IIS, right click on Service virtual directory and Manage WCF and WF service  Configure.
a. In Monitoring section check write events to database and select connection string.
b. Select the level, default is Health Monitoring
4. Add monitoring section in the service’s config file.
<microsoft.applicationServer>
<monitoring>
<default enabled="true"
connectionStringName="ApplicationServerMonitoringConnectionString"
monitoringLevel="EndToEndMonitoring" />
</monitoring>
</microsoft.applicationServer>
For Testing WCF service: use WCFTestClient.exe
For Dashboard reset:
Delete [<AppFabricDBName>].[ASWcfEventsTable]
Example: delete [AppFabricMonitoringStoreDB].[dbo].[ASWcfEventsTable]
Reference links
Download:
 http://www.microsoft.com/en-us/download/details.aspx?id=15848 (Windows Server 2008 R2
x64 - WindowsServerAppFabricSetup_x64_6.1.exe)
Trouble shooting:


http://stackoverflow.com/questions/4508576/i-think-i-configured-appfabric-correctly-butnothing-is-happening-on-appfabric-d
http://blogs.msdn.com/b/appfabriccat/archive/2010/08/13/windows-server-appfabricmonitoring-purging-of-appfabric-monitoring-data-don-t-get-caught.aspx
Monitoring Details:

http://msdn.microsoft.com/en-us/library/ee677276%28v=azure.10%29.aspx
WCF Call History section details:

http://msdn.microsoft.com/en-us/library/ee677282%28v=azure.10%29.aspx
Download