Asynchronous Transactions Monitoring

Asynchronous transactions are widely used to improve the performance of business applications, as they allow multiple tasks to execute concurrently instead of having to wait for previous tasks to finish executing, but monitoring and troubleshooting applications that use asynchronous transactions can be complex and challenging. AppDynamics automatically discovers asynchronous activities in your application environment and provides powerful tools for performance monitoring and debugging.

Overview

Multithreaded and asynchronous programming patterns are commonly used to create scalable, high performance applications. However, when a transaction does include such an interaction, monitoring transaction end-to-end performance becomes tricky, as poorly performing asynchronous activities can complete many seconds after you think the transaction has finished. Different from other application performance monitoring applications, AppDynamics offers Asynchronous Transaction monitoring out of the box. You can also configure end-to-end latency and other performance metrics to troubleshoot problems such as deadlocks or race conditions.

For example, consider a travel booking application (“Flight Search”) that lets you check flight prices for multiple airlines at the same time.

Using a synchronous architecture, the Flight Search application would query each airline web service sequentially, first A then B then C. The total time to execute the search is A + B + C.

Using an asynchronous model, Flight Search queries all three airlines at the same time, thereby reducing the total time of search to the query with the longest response time among the three. In modern business applications, asynchronous transactions are widely used to improve application performance.

Many Application Performance Management tools aren’t able to detect and track asynchronous calls. AppDynamics can, and automatically discovers asynchronous activities in your application. Once your application is instrumented and connected to the controller, AppDynamics gives you a visualization of the components that are making multithreaded and asynchronous calls.  If there are slow transactions or exceptions, AppDynamics shows full call graphs - a list of methods in a call stack - that present asynchronous activity in a logical sequence. Where asynchronous requests return results after the calling thread finishes processing, you can manually configure endpoints to gather the end-to-end metrics and view them in the Metric Browser.

AppDynamics supports asynchronous programming patterns for both Java and .NET applications:

  • For Java, AppDynamics detects multithreaded transactions based upon the Runnable or Callable interfaces of the Thread class. When spawned threads execute exit calls to backends, AppDynamics treats them as asynchronous exit calls. For instance, in our hypothetical Flight Search application the search/fares transaction thread would spawn multiple threads to handle the web service calls to each airline site and AppDynamics allows you to monitor those as part of the overall business transaction.For more information see "Monitoring Asynchronous and Thread Processing Activity" on Trace Multithreaded Transactions for Java.
  • In .NET, AppDynamics discovers the async/await programming pattern for exit calls to most backends. In our Flight Search example search example, an async method might be used to handle all web service calls to individual airlines. See Asynchronous Exit Points for .NET. The AppDynamics .NET Agent also traces multithreaded activity based upon the Thread.Start and the ThreadPool.QueueWorkerItem methods. See Enable Thread Correlation for .NET.
AppDynamics detects outbound activity to web services, http servers, message queues, and other systems as backend exit calls.  AppDynamics differentiates asynchronous calls as dashed lines with the label "async" on flow maps so you immediately see asynchronous activity.
When AppDynamics detects a business transactions that is running slowly or has errors, we take a snapshot that gives a cross-tier view of the processing flow for that invocation of the transaction.  The snapshot flow map shows asynchronous task processing time for each entity associated with asynchronous activity. Many transaction snapshots have a call graph showing the timing and errors for specific methods in your code. AppDynamics links asynchronous code paths so you can track the code execution along spawned threads. For the .NET async/await pattern, AppDynamics includes await activity in-line in the same sequence as the source code.
Troubleshooting asynchronous code problems such as deadlocks in a production environment can be tricky. With AppDynamics, whenever there is a code level problem, an event is created and will show up on the dashboard to notify you. If you have an alert set up, an Email or SMS message will be sent to you or your Ops team so you can start troubleshooting the problem before the business impact escalates.

It is easy to set up asynchronous transaction monitoring using a configuration wizard. First, you will create a new asynchronous transaction demarcator to identify when an asynchronous business transaction is complete:

  • Transaction is complete when last thread on specified Tier is finished running. You can choose a  Demarcation Tier from a dropdown menu.

  • Transaction is complete when specified class/method is invoked. You can manually put in class and method name.

Then specify the business transactions that should use this demarcator. AppDynamics will treat these as asynchronous transactions and you can monitor end-to-end performance or troubleshoot your applications in the usual way.

The performance metrics for asynchronous transactions are:

  • Average End to End Latency: The average time in milliseconds spent processing end-to-end message transactions over the selected time frame. 
  • Slow End to End Messages: The number of end-to-end transactions that exceeded the slow threshold for the business transaction over the selected time frame. 
  • Very Slow End to End Latency: The number of end-to-end transactions that exceeded the very slow threshold for the business transaction over the selected time frame. 
Try AppDynamics

Introduction

Multithreaded and asynchronous programming patterns are commonly used to create scalable, high performance applications. However, when a transaction does include such an interaction, monitoring transaction end-to-end performance becomes tricky, as poorly performing asynchronous activities can complete many seconds after you think the transaction has finished. Different from other application performance monitoring applications, AppDynamics offers Asynchronous Transaction monitoring out of the box. You can also configure end-to-end latency and other performance metrics to troubleshoot problems such as deadlocks or race conditions.

What is an asynchronous transaction

For example, consider a travel booking application (“Flight Search”) that lets you check flight prices for multiple airlines at the same time.

Using a synchronous architecture, the Flight Search application would query each airline web service sequentially, first A then B then C. The total time to execute the search is A + B + C.

Using an asynchronous model, Flight Search queries all three airlines at the same time, thereby reducing the total time of search to the query with the longest response time among the three. In modern business applications, asynchronous transactions are widely used to improve application performance.

How do we monitor asynchronous transactions

Many Application Performance Management tools aren’t able to detect and track asynchronous calls. AppDynamics can, and automatically discovers asynchronous activities in your application. Once your application is instrumented and connected to the controller, AppDynamics gives you a visualization of the components that are making multithreaded and asynchronous calls.  If there are slow transactions or exceptions, AppDynamics shows full call graphs - a list of methods in a call stack - that present asynchronous activity in a logical sequence. Where asynchronous requests return results after the calling thread finishes processing, you can manually configure endpoints to gather the end-to-end metrics and view them in the Metric Browser.

What languages are supported

AppDynamics supports asynchronous programming patterns for both Java and .NET applications:

  • For Java, AppDynamics detects multithreaded transactions based upon the Runnable or Callable interfaces of the Thread class. When spawned threads execute exit calls to backends, AppDynamics treats them as asynchronous exit calls. For instance, in our hypothetical Flight Search application the search/fares transaction thread would spawn multiple threads to handle the web service calls to each airline site and AppDynamics allows you to monitor those as part of the overall business transaction.For more information see "Monitoring Asynchronous and Thread Processing Activity" on Trace Multithreaded Transactions for Java.
  • In .NET, AppDynamics discovers the async/await programming pattern for exit calls to most backends. In our Flight Search example search example, an async method might be used to handle all web service calls to individual airlines. See Asynchronous Exit Points for .NET. The AppDynamics .NET Agent also traces multithreaded activity based upon the Thread.Start and the ThreadPool.QueueWorkerItem methods. See Enable Thread Correlation for .NET.

Viewing asynchronous calls

AppDynamics detects outbound activity to web services, http servers, message queues, and other systems as backend exit calls.  AppDynamics differentiates asynchronous calls as dashed lines with the label "async" on flow maps so you immediately see asynchronous activity.

Call Graphs - code level visibility

When AppDynamics detects a business transactions that is running slowly or has errors, we take a snapshot that gives a cross-tier view of the processing flow for that invocation of the transaction.  The snapshot flow map shows asynchronous task processing time for each entity associated with asynchronous activity. Many transaction snapshots have a call graph showing the timing and errors for specific methods in your code. AppDynamics links asynchronous code paths so you can track the code execution along spawned threads. For the .NET async/await pattern, AppDynamics includes await activity in-line in the same sequence as the source code.

Troubleshooting code problems

Troubleshooting asynchronous code problems such as deadlocks in a production environment can be tricky. With AppDynamics, whenever there is a code level problem, an event is created and will show up on the dashboard to notify you. If you have an alert set up, an Email or SMS message will be sent to you or your Ops team so you can start troubleshooting the problem before the business impact escalates.

How do I configure asynchronous monitoring

It is easy to set up asynchronous transaction monitoring using a configuration wizard. First, you will create a new asynchronous transaction demarcator to identify when an asynchronous business transaction is complete:

  • Transaction is complete when last thread on specified Tier is finished running. You can choose a  Demarcation Tier from a dropdown menu.

  • Transaction is complete when specified class/method is invoked. You can manually put in class and method name.

Then specify the business transactions that should use this demarcator. AppDynamics will treat these as asynchronous transactions and you can monitor end-to-end performance or troubleshoot your applications in the usual way.

Understanding asynchronous performance metrics

The performance metrics for asynchronous transactions are:

  • Average End to End Latency: The average time in milliseconds spent processing end-to-end message transactions over the selected time frame. 
  • Slow End to End Messages: The number of end-to-end transactions that exceeded the slow threshold for the business transaction over the selected time frame. 
  • Very Slow End to End Latency: The number of end-to-end transactions that exceeded the very slow threshold for the business transaction over the selected time frame. 

What's next

Try AppDynamics
Getting Started
  1. Install AppDynamics app agents on your system to instrument your code and discover asynchronous activity:
  2. Monitor asynchronous transactions in flow maps and view the metrics the metric browser.
  3. Troubleshoot problems with your asynchronous code in call graphs.
  4. Fine-tune the endpoints asynchronous transactions to ensure your end-to-end processing times capture the full logical flow of a business transaction. 
Video Thumbnail
Advanced Training
Video Thumbnail
Asynchronous Application Patterns