Tracking Background Transactions


In a typical web application, the user communicates with the application via HTTP requests; these requests access the application server and render the requested data back to the user. Aside from these web transactions, there could be a number of transactions being executed in an application. These transactions may not be triggered by the user but they're still vital for the application to properly function. In general, transactions that do not come under user purview are considered background transactions.

Common examples include maintenance, schedulers, messaging, data archiving, etc. Since these transactions run in the background, it's easy to overlook their performance. You often won't know if these transactions are successful or not unless a major issue bogs down your entire application. This is why monitoring background transactions is essential for quickly debugging errors. APM Insight also captures these transactions and list them under Background tab in APM Insight dashboard.

Note: This feature is available in .NET & Java agents only.

How to monitor background transactions?

Unlike web transactions, which are implemented using known frameworks like Struts, Play, Spring, etc., background transactions are custom-coded by developers to meet their specific needs and requirements. These are not captured by the APM Insight agent by default, but can be monitored using custom instrumentation.

With custom instrumentation, you can use defined methods and classes. Include the specified code at the beginning of a method or class, and the agent will start tracking its performance.

Note: Standalone HTTP URLs are no longer tracked as background transactions, i.e, background transaction with only HTTP call will no longer be monitored as background transaction. If they are part of any other transaction, only then they will be tracked.

Metrics captured

To enable tracking of background transactions, follow the steps given below:
  1. Log into your Applications Manager account.
  2. Under APM Insight tab, navigate to APM Insight app → Edit APM Insight Application Configuration.
  3. Go to APM Insight Agent Configuration Profile → Edit APM agent configuration profile → Background transactions and enable the Track background transactions checkbox.
  4. Finally, click Save.

Configuration for background transactions is explained below:

Configuration Description Default Value
bgtransaction.tracking.enabled
  • Enabling this option, APM Insight agent starts tracking background transactions
  • All transactions other than HTTP are considered as background transactions
true
bgtransaction.trace.enabled
  • Enabling this option, the agent collects traces for slow background transactions, provided bgtransaction.tracking.enabled is set to true
true

bgtransaction.trace.threshold

  • Traces will be collected for background transactions whose response time have crossed the specified threshold value, provided bgtransaction.trace.enabled is set to true.
5 (seconds)
bgtransaction.record.cputime.enabled
  • Record CPU time for every background transaction, if enabled.
false
bgtransaction.record.memory.allocation.enabled
  • Memory allocated for background transactions will be captured, if this option is enabled.
true
bgtransaction.trace.external.components.count.threshold
  • Trace snapshot will be taken for background transactions which has total external components (like MYSQL, MEMCACHED, etc) call count equal or higher than the configured number.
40
bgtransaction.tracking.request.interval
  • Sampling factor for background transactions
  • If value is set to 1, agent tracks every transaction. If value is set to n, agent tracks 1 in N transactions of same kind.
1 (request) for Java & 5 for .Net agent
 
Note:
  • These values cannot be changed during run-time for java agent. For the changes to be effective, server restart is required.
  • Restart is not required servers using .Net agent, the values will be updated in run-time.