Our forward-looking statement applies to roadmap projections.

Roadmap corresponds to June 2025 projections.

Guide Overview

Asynchronous processing increases scalability by allowing higher limits per context, as asynchronous requests execute in their own threads behind the scenes, without users having to wait for them to complete before moving on to other work.

We commonly use the phrase “Fire and Forget” to refer to patterns that involve asynchronous processing. These patterns can improve user experiences by enhancing UI responsiveness since users can continue to do work on the client side while related tasks execute in the background.

To visualize what this might look like in Salesforce, consider an asynchronous ordering process. When an order is saved, it triggers a message to an external warehouse management system with special instructions for how to pack and ship an item. Since the user placing the order doesn’t need an immediate response from the warehouse management system, the request can be sent asynchronously, allowing the user to continue their work without delays.

Three important things to keep in mind, however, are:

  1. Asynchronous processing is not the best approach for every problem. It can be tempting to think of any process that doesn’t directly require user interaction to be a good candidate for asynchronous processing, but there are some additional considerations. First, that asynchronous processes have no SLA, which means that there’s no guarantee that an async process will complete within a set amount of time. Second, there’s no guarantee of consistent response latency. Just because an asynchronous process completes within a certain amount of time doesn’t mean that subsequent processes will also finish within that amount of time. Even if a user isn’t directly waiting for a response, if you have follow-on processes that are waiting for one or if you’re concerned that excessive response times might cause your data to become out of sync with the data in an external system, you should reconsider whether asynchronous processing is right for your scenario.
  2. There are different ways to process asynchronous requests on the Salesforce Platform and you need to make sure that you’re choosing the best approach. Tools that support asynchronous processing on the Salesforce Platform work differently “under the hood” and some were designed for very specific use cases.
  3. When a tool is asynchronous on the client side, it does not necessarily follow that all of the end-to-end processing is going to be performed in parallel: Depending on the choices you make, the client's messages might still get serialized on the server side.

Using the wrong tools, or the wrong combinations of tools for the wrong jobs can have unintended consequences that cancel out the benefits that asynchronous processing may have provided. This guide provides explanations and recommendations, as well as potential drawbacks and anti-patterns for various asynchronous use cases along with the rationale for those recommendations. It also provides insight into how various asynchronous implementation techniques operate and are regulated on the Salesforce core platform.

Note that this guide focuses exclusively on asynchronous processing within the core Salesforce Platform. If you are looking for information about asynchronous integration patterns, make sure to check out the Architect’s Guide to Event-Driven Architecture.

Key Takeaways

Tools for Asynchronous Processing with Salesforce

The table below outlines the tools that are available for asynchronous processing with Salesforce. This guide will dive deeper into how to choose between these tools in the following sections, but you can refer to this table for each tool’s major characteristics during your decision-making process.

Product / Approach Use Cases Skills Required Additional License Required
Apex Future Methods Execute long-running operations, such as callouts to external web services or operations that need to run in their own threads, on their own time. Pro Code No
Apex Queueable Prefer this approach over Future methods for processes that involve long running database operations or external web service callouts as it offers additional benefits including job IDs, support for non-primitive types and job chaining. Pro Code No
Apex Continuation Callouts Execute callouts from Apex methods running in a synchronous transaction context Pro Code No
Platform Event Triggers Loosely couple Salesforce with external systems and communicate between asynchronous components within the Salesforce Platform Low Code + Pro Code Add-on required for high-volume platform event use cases
Scheduled Path (After Commit Flows) Execute at a dynamically scheduled time after a triggering event, such as when a record is created, updated, or deleted Low Code No
Asynchronous Path (Record-Triggered Flows) Execute an operation that you want to run on its own time and avoid mixed DML errors that occur when you need to update a value on a related record that is not part of the record that triggered a flow Low Code No
Outbound Messages Share data with third party systems in near real time via the SOAP protocol Low Code No
Email-to-Case Automatically create cases and populate case fields based on values in incoming emails Low Code No
Batch Apex Build complex, long-running processes that involve thousands of records by dividing up your record set and processing it in manageable chunks. Pro Code No
Scheduled Flows Execute a flow in the background at a specified time and at a repeated frequency (daily, weekly, or once) to perform actions on a batch of records. Low Code No
Bulk API Insert, update, upsert, query, or delete many records asynchronously and process the results later. Pro Code No
Lightning Actions Allow Lightning pages to interact with the server without users having to fully refresh the page Low Code No
Visualforce JavaScript Remoting (Legacy)** Decoupling Visualforce pages from their Apex controllers to allow users to perform tasks without having to reload the entire page. Pro Code No
Salesforce Dashboards Create visual displays of data from Salesforce reports Low Code No
CRM Analytics Explore and visualize CRM data interactively Low Code Yes
*Visualforce is no longer the preferred method for building custom UX components in Salesforce, as the Lightning Framework offers greater flexibility

Decision Points At-a-Glance

The table below contains an overview of the decision points that you'll want to think about when making your tool selections, along with questions you should be asking yourself about each one.

Skills Required Some of the tools outlined in this guide require code while others can be configured declaratively. As you consider your options, think about the skillsets that your team members have. Keep in mind that even if developers are available for your initial implementation (through an implementation partner, for example), you may need to modify your solutions in the future. If your maintenance team lacks developers, you may be better off with a low code option.
Asynchronous with Respect to Client This attribute indicates that client-side code is executed asynchronously within a browser or mobile app. It's important to remember that even if code executes asynchronously on the client side, there's a possibility that requests may be serialized and executed synchronously on the server side. As you're designing your solutions, ask yourself how processing is going to be handled on both sides and make sure you're not introducing any unintended bottlenecks.
Asynchronous with Respect to Server This attribute indicates that server-side processing is handled asynchronously within the Salesforce Platform. Keep in mind that asynchronous patterns do not have SLAs, so if you're designing processes that involve a user needing a response before they can continue with their work, a tool that processes information synchronously will most likely be a better fit.
Type of Platform Limits Enforced This attribute indicates the type of limits that execution is subject to. As you design your solutions, think carefully about how the volume and frequency of transactions may impact the number of SOQL queries the system needs to execute, the amount of processing time each transaction will require, and the amount of memory the system will need to complete the execution. Make sure that the values you calculate fall within the limits associated with your selected tools.

Server-Side Asynchronous Processing

When choosing the right tool for server-side asynchronous processing, start by evaluating your organization’s requirements and available resources. Your goal is to select the tool or tools that will keep your implementation and maintenance costs to a minimum, while also ensuring scalability and minimizing your likelihood of limit violations. This will be dependent on the technical considerations outlined in the tables below, as well as the makeup of your team (do you have Apex developers on staff who can maintain your solution or would a declarative approach make more sense?). Also note that different tools are enforced by different sets of limits.

Questions to ask:

Asynchronous Apex

The Salesforce Platform’s multitenant architecture isolates and concurrently supports the varying requirements of many tenants (orgs). All asynchronous Apex methods covered in this guide are executed within the same asynchronous infrastructure in the Salesforce Platform. They use a message queueing framework that is governed by two primary enforcement mechanisms: flow control and fair usage.

The purpose of flow control and fair usage is to prevent a single tenant from using too many server resources and not leaving enough for the remaining tenants. While it's good to understand how these mechanisms work, your key takeaway should be that following best practice guidelines for asynchronous processing (such as the ones outlined in the sections below) will significantly reduce your likelihood of running into issues with them.

Flow Control

The platform’s flow control mechanism prevents one org from flooding a given message type, consuming too many threads and negatively affecting other orgs. Prior to adding new entries to the queue associated with a message type, the framework will check the first several thousand existing entries in the queue to see if other orgs have work to be done. If the majority of existing entries are associated with a single org that already has entries in worker threads, the newly added entries will be moved to the back of the queue (a process called re-enqueuing). This typically happens to Batch Apex and Bulk API processes, as they tend to insert large numbers of entries into their queues at once.

Batch Apex Message Re-EnqueueingMessage Re-Enqueueing

Fair Usage

The platform’s fair usage algorithm implements a tier-based system that ensures that each org on the Salesforce Platform gets a “fair share” of processing time on a given message type (i.e. Future, Queueable, Batch). If one org is dominating a given message type and other orgs are waiting to perform work on the same message type, the fair usage algorithm will reduce the number of threads that org has available for that particular message type.

Fair Usage AlgorithmFair Usage Algorithm

A benefit of using asynchronous Apex methods is that some governor limits, such as SOQL query limits and heap size limits are higher. However, you shouldn’t rely too heavily on these methods. Due to the finite nature of the resources allocated to asynchronous infrastructure, heavily using Future, Queueable, and Batch Apex can cause processing delays that stem from limitations based on fair usage and flow control.

Special Considerations for Outbound Callouts via Asynchronous Apex

Outbound callouts that use asynchronous Apex are counted against the asynchronous Apex limit. The daily limit is currently 250,000 or 200 times the number of user licenses, whichever is greater. This can be an issue for high-volume use cases. If you exceed the limit, your asynchronous Apex jobs and their associated outbound callouts will fail.

Additionally, since the platform has a finite number of asynchronous threads available, outbound integrations via asynchronous Apex will have limited scalability in general, as any outbound integrations involving high volumes of messages that exceed the number of threads and have long processing times will lead to delays.

For high-volume use cases, consider the alternative approaches outlined below. API calls with these approaches count towards the daily API request limit, which is currently 5000 for every user license. This is a significantly higher limit and will be much more scalable than asynchronous Apex. Note, however, that there are still physical limitations on the number of concurrent requests that any CPU can process. Regardless of which pattern you use, it’s always best to limit concurrent requests to < 200 per second in order to avoid throttling.

Middleware Scheduled PullMiddleware Scheduled Pull

Middleware Pull via Platform Event NotificationsMiddleware Pull via Platform Event Notification

Asynchronous Apex Tradeoffs

Product / Approach Use Cases Skills Required Asynchronous with Respect to Client Asynchronous with Respect to Server Type of Platform Limits Enforced
Apex Future Methods Long-running operations that need to run in their own threads, on their own time Pro Code Yes Yes Asynchronous
Apex Queueable Preferred over Future methods for processes that involve long running database operations or external web service callouts Pro Code Yes Yes Asynchronous
Apex Continuation Callouts Callouts from Apex methods running in a synchronous transaction context Pro Code Yes Yes Synchronous

Apex Future Methods and Apex Queueable

You can call a future method to execute long-running operations, such as callouts to external web services, or operations that need to run in their own threads, on their own time. Each future method is queued and executes when system resources become available. This ensures that your code’s execution will not have to wait for the completion of a long-running operation.

Apex Queueable is an enhanced way of running asynchronous Apex (compared to using future methods), and should be your preferred approach. You can run Apex processes that involve extensive database operations or external web service callouts asynchronously by implementing the Queueable interface and adding a job to the Apex job queue. This will ensure that the asynchronous Apex job will run in the background in its own isolated thread and won’t delay the execution of your main Apex logic. Just like with future methods, each queued job runs when system resources become available. Queueable jobs provide some additional benefits as well:

Considerations for Apex Future Methods and Apex Queueable

Salesforce uses a queue-based framework to handle asynchronous processes. This queue is used to balance request workloads across organizations. In order to ensure that your organization is using this queue as efficiently as possible, you should:

Apex Continuations

Historically, synchronous callouts made from an Apex method running in a synchronous Apex transaction context (for example, a Visualforce controller or Lightning controller) would be counted toward the Apex concurrency limit of 10 synchronous requests that are longer than five seconds in duration. As of Winter ’19, synchronous callouts are no longer counted as long-running. Apex continuations were initially created as a solution to synchronous callouts that resulted in long-running requests, but they also provide some additional benefits:

Considerations for Apex Continuations

While continuations execute asynchronously with respect to the originating synchronous action, they do not share anything in common with asynchronous Apex techniques such as future methods, Queueable, or Batch. Key differences are:

Platform Events

Platform events are the Salesforce Platform’s implementation of a purely event-driven architecture. You can find more details about the components associated with this type of architecture in the Architect’s Guide to Event-Driven Architecture.

Platform events and platform event triggers/flows are often great alternatives to running asynchronous Apex, such as future methods and Queueable. They’re also a great way to invoke off-platform processing. An example of this is using a combination of Amazon Web Services (AWS) event relays and platform events to invoke serverless compute functionality in AWS Lambda. If the work being performed is relatively fast and performs no callouts (which are not possible from a platform event trigger or flow), this could be a great use case for a platform event/trigger or event/flow combination.

Asynchronous Processing via Platform EventsAsynchronous Processing via Platform Events

The events published to the bus via publish after commit are delivered in order and can be bulk processed by the trigger or flow in a separate synchronous context. It is important to note that the context is synchronous and enforces all synchronous governor limits. Choose the platform event trigger/flow batch size carefully to avoid hitting limits.

Product / Approach Use Cases Skills Required Asynchronous with Respect to Client Asynchronous with Respect to Server Type of Platform Limits Enforced
Platform Event Triggers Loosely couple Salesforce with external systems and communicate between asynchronous platform components Low Code + Pro Code Yes Yes Synchronous

Considerations for Platform Events

From a daily/hourly limit perspective, the first approach is more efficient as it simply consumes less platform event publish operations than the latter approach.

Roadmap Note: Beginning in Winter ’24, it will be possible to process multiple subscriptions simultaneously instead of a single subscription via Parallel Subscriptions for Apex Triggers.

It is helpful to use real-time platform events for use cases such as logging, where you want to publish the logging event regardless of whether the transaction succeeds and commits, or fails and rolls back. However, real-time platform events must be used carefully and thoughtfully. It is possible to publish a real-time platform event that is consumed by a platform event trigger that competes for a database row lock with the transaction that published it. Review all designs thoroughly prior to publishing real-time platform events to ensure that this scenario is avoided.

Asynchronous Flows

Asynchronous flows provide low-code alternatives to asynchronous Apex. Just like with other forms of asynchronous processing, they execute in the background when resources are available but also have no SLAs and can have unpredictable wait times.

Product / Approach Use Cases Skills Required Asynchronous with Respect to Client Asynchronous with Respect to Server Type of Platform Limits Enforced
Scheduled Path (After Commit Flows) Execute at dynamically scheduled times after triggering events Low Code Yes Yes Asynchronous
Asynchronous Path (Record-Triggered Flows) Execute an operation that you want to run on its own time and avoid mixed DML errors Low Code Yes Yes Asynchronous

Scheduled Paths are cron-trigger based to execute at a specific time. They execute when records are created, updated or deleted and give you granular control over when to run the automation relative to the record change. (Example: send an email to a user one hour before a task is due.) Unlike Apex future methods, which are limited to a maximum of 50 enqueued in a synchronous transaction, scheduled flow actions do not currently have a max enqueue limit per transaction. There is however a batch size configuration within the definition of the scheduled path that allows for some control over how many records are handled by the scheduled path flow execution.

Asynchronous Paths can be added to record-triggered flows. They run in the background and won’t delay the execution of the transaction that originally triggered the flow. You can use an asynchronous path to execute a long-running operation, or any operation that you want to run on its own time. Asynchronous paths can help avoid mixed DML errors that occur when you need to update a value on a related record that is not part of the record that triggered the flow.

Outbound Messages

Note: Outbound messaging is a legacy feature, and while it is still a viable option for sending asynchronous messages, platform events (described in the previous section) are a more modern approach and offer greater flexibility.

Outbound messages provide a means of asynchronous outbound communication via SOAP API. When configured in Salesforce, the outbound message definition produces a SOAP WSDL that can be consumed by an external web service provider. Outbound messages can be triggered from workflow rules, Process Builder processes, or Lightning after-save flow triggers. An outbound message SOAP message can contain up to 100 notifications. Each notification contains the object ID and a reference to the associated sObject data. If the information in the underlying object changes after the notification is queued but before it is sent, only the latest data is delivered and not the intermediate changes.

Product / Approach Use Cases Skills Required Asynchronous with Respect to Client Asynchronous with Respect to Server Type of Platform Limits Enforced
Outbound Messages Share data with third party systems in near real time via the SOAP protocol Low Code N/A Yes N/A

When an outbound message listener (the web service you configured with the generated WSDL) receives a message, it uses the included session ID information to call the Lightning Platform API to update the record in Salesforce that triggered the outbound message.

Considerations for Outbound Messages

Email-to-Case

Product / Approach Use Cases Skills Required Asynchronous with Respect to Client Asynchronous with Respect to Server Type of Platform Limits Enforced
Email-to-Case Automatically create cases and populate case fields based on values in incoming emails Low Code Yes Yes* Synchronous
* Email-to-Case is handled as both sync and async, but with synchronous Apex limits

Email-to-Case normally works in a synchronous manner. There are a limit of four synchronous threads to handle inbound Email-to-Case requests as the synchronous form of the handler actually maintains a connection to the inbound Salesforce mail server (MTA) that is receiving the email. However, there are a number of reasons why Email-to-Case would be handled in an asynchronous fashion:

Considerations for Email-to-Case

Large Record Volume Processing

If you need to process large volumes of records asynchronously, use one of the approaches outlined below instead of the asynchronous Apex approaches described above, which are a better fit for lower volume processing. Keep in mind, however, that Batch Apex and the Bulk API are both subject to their own sets of limitations, which are described in this section.

Product / Approach Use Cases Skills Required Asynchronous with Respect to Client Asynchronous with Respect to Server Type of Platform Limits Enforced
Batch Apex Complex, long-running processes that involve thousands of records Pro Code Yes Yes Asynchronous
Scheduled Flows Perform actions on a batch of records in the background at a specified time and at a repeated frequency via Flow. Low Code Yes Yes Synchronous
Bulk API Insert, update, upsert, query, or delete many records asynchronously. Pro Code Yes Yes Asynchronous

Batch Apex

You can use Batch Apex to build complex, long-running processes that involve thousands of records. Batch Apex operates by dividing up your record set and processing it in manageable chunks. As an example, you can build an archiving solution that runs on a nightly basis and adds records older than a certain date to an archive. Or you can build a data cleansing operation that looks at all Accounts and Opportunities on a nightly basis and performs any necessary updates based on a set of predefined criteria.

Considerations for Batch Apex

Scheduled Flow

A Scheduled Flow is a flow scheduled to execute at a specified time and at a repeated frequency (daily, weekly, or once) to perform actions on a batch of records. (Example: update a field in all cases with a status of "Open" at 2am every night). Scheduled Flows are executed via the cron trigger mechanism and bulk processed.

Considerations for Scheduled Flows

Bulk API and Bulk API 2.0

Bulk API is based on REST principles and is optimized for working with large sets of data. You can use it to insert, update, upsert, query, or delete many records asynchronously and process the results later. The Salesforce Platform will process the request in the background. In contrast, SOAP API and REST API use synchronous requests and are optimized for real-time client applications that update a few records at a time. You can use both of these APIs for processing many records, but when the data sets contain hundreds of thousands of records, they are less practical. Bulk API’s asynchronous framework is designed to make it simple and efficient to process data from a few thousand to millions of records.

The easiest way to use Bulk API is to enable it for processing records in Data Loader using CSV files. With Data Loader, you don’t have to write your own client app. Sometimes, though, unique requirements necessitate writing a custom app.

There are two Bulk APIs available within the Salesforce Platform.

The table below provides a comparison of the two:

Data Loader Support Batch Size Setting Enable PK Chunking Serial Mode Allowed Thread Limits Daily Batch Limits Concurrent Batch Limits Daily Record Limits Apex Limits per 200 Row Chunk
Bulk API Yes Manual Manual Yes One thread per org for serial jobs 15,000 Variable** 10,000 records per batch 15 seconds CPU
100 SOQL Queries
6MB Heap
Bulk API 2.0 No Automatic Automatic No Query jobs have no thread limit* N/A CRUD jobs are limited to a maximum of 5 concurrent batches per org per job.*** 150,000,000 records 65 seconds CPU
200 SOQL Queries
12MB Heap
*As query jobs enable PK chunking automatically, the entire job will automatically be divided into batches based on the PK chunk range, which can consume large numbers of threads if the query results in a very large number of rows.
**The overall concurrent batch limit is dictated by available threads and the asynchronous fair usage algorithm.
***Note that the asynchronous fair usage algorithm can still limit concurrent batches if multiple jobs are dispatched, as each job gets up to five threads.

Considerations for Bulk API

Client-Side Asynchronous Processing

While the platform handles the majority of asynchronous requests “behind the scenes” on the server side, tools that support asynchronous processing on the client side are also available. Note that client-side asynchronous processing is subject to the limitations of the browser or mobile application within which it is executing.

Questions to Ask:

Product / Approach Use Cases Skills Required Asynchronous with Respect to Client Asynchronous with Respect to Server Type of Platform Limits Enforced
Lightning Actions Allow Lightning pages to interact with the server without full page refreshes Low Code Yes No Synchronous
Visualforce JavaScript Remoting (legacy)* Allow Visualforce pages to interact with the server without full page refreshes Pro Code Yes No Synchronous
*Visualforce is no longer the preferred method for building custom UX components in Salesforce, as the Lightning Framework offers greater flexibility

Lightning Actions (XHR requests)

All Lightning communications from the browser to the Salesforce Platform take the form of XMLHttpRequest (XHR) requests. This allows Lightning pages to interact with the server without having to fully refresh the page. Each of these actions results in a synchronous transaction context on the Salesforce Platform.

Considerations for Lightning Actions

Boxcar’ing in Lightning Actions

Lightning applications involve frequent communication to the Salesforce Platform to support the Lightning Framework. To support this, multiple requests can be issued at the same time, or “boxcar’ed” in a single XHR request to the Salesforce core platform. The maximum boxcar limit for Lightning is 2500 maximum actions per request. However, each of the boxcars within a request will be processed serially and in order in a separate transaction context. For example, if 100 custom Apex Lightning actions are boxcar’ed together and each takes four seconds to run, 100 separate Apex transactions will be executed on the Salesforce Platform under the same request, taking a total of 400 seconds to complete. In the browser, there would be a single XHR request issued that would take 400 seconds before a response was received.

Boxcar'ing in Lightning ActionsBoxcar'ing in Lightning Actions

If you are building an application that uses polling or timers, you should wrap any code that modifies a component outside the normal rerendering lifecycle in $A.getCallback(). This will ensure that the framework will rerender the modified component and processes any enqueued actions right away. Not taking this approach can cause actions to be queued up indefinitely until a callback is requested through a different process (for example, a user returns to their desk and performs some other action in the system), which will send all of the queued up actions to the server simultaneously in transactions that have very high numbers of boxcars.

Visualforce JavaScript Remoting (Legacy)

Note: Visualforce is no longer the preferred method for building custom UX components in Salesforce, as the Lightning Framework (described in the previous section) offers greater flexibility. However, you may still encounter Visualforce pages in existing implementations.

JavaScript remoting is a tool that front-end developers can use to make an Ajax request from a Visualforce page directly to an Apex controller. JavaScript remoting allows you to run asynchronous actions by decoupling the page from the controller and performing tasks on the page without having to reload the entire page. This helps alleviate view state issues while still executing in the context of the user viewing the page. JavaScript remoting also allows you to ensure that you’re passing only the data that you need each time that you make a call.

Considerations for JavaScript Remoting

Boxcar’ing in JavaScript Remoting

Multiple JavaScript remoting requests can be issued at the same time by boxcar’ing them in a single HTTP request to the Salesforce core platform. On the platform, each of the boxcars (i.e. a separate JavaScript remoting action) will be processed serially and in order in a separate Apex synchronous transaction context. For example, if 10 remoting actions were boxcar’ed together and each took four seconds to run, 10 separate Apex transactions would be executed on the Salesforce Platform under the same request, taking a total of 40 seconds to complete. There would be a single request issued in the browser that would take 40 seconds before a response was received.

Boxcar'ing in JavaScript RemotingBoxcar'ing in JavaScript Remoting

Data Visualizations

Product / Approach Use Cases Skills Required Asynchronous with Respect to Client Asynchronous with Respect to Server Type of Platform Limits Enforced
Salesforce Dashboards Create visual displays of data from Salesforce reports Low Code Yes Yes Asynchronous*
CRM Analytics Explore and visualize CRM data interactively Low Code Yes Yes Asynchronous
*Dashboards execute asynchronously and are subject to the same fair usage and flow control limits as asynchronous Apex message types

Salesforce Dashboards

Unlike reports that run directly via the UI or API, dashboard-based reports actually execute asynchronously and are subject to both fair usage and flow control limitations, just like the asynchronous Apex message types. Dashboard-executed reports map into four separate asynchronous message queues for the reports: SMALL, MEDIUM, LARGE, and UNKNOWN. When a dashboard is refreshed, the reports underlying the dashboard panels are submitted to the various dashboard message queues. As the reports complete execution, the various dashboard panels will render in the UI.

Considerations for Dashboards

Reports used for dashboards should follow all report performance best practices. If any of the reports that a dashboard executes time out during execution, the dashboard status will remain as stale. When a user lands on a stale dashboard, the reports are automatically resubmitted to the message queues to execute. This can lead to message queue thread starvation of other message types due to overwhelming volumes of dashboard report message types.

CRM Analytics

There are four scenarios where asynchronous processing occurs within CRM Analytics:

Considerations for CRM Analytics

All of the processes mentioned above utilize the Bulk API in the background, but it's important to note that instead of being subject to Bulk API’s limits, they are subject to CRM Analytics Limits. Keep these limits in mind when working with large data volumes in CRMA.

Monitoring Asynchronous Processing

Because asynchronous processing happens in the background, any failures that may occur are typically not reported in the UI and thus may go unnoticed. Additionally, while rare, the platform’s flow control mechanism or fair usage algorithm may determine that asynchronous jobs need to be put on hold to ensure platform stability. This can create scenarios where synchronous processes attempt to perform CRUD operations on records that should already have been updated by asynchronous processes that haven’t run yet.

Issues like these make monitoring and alerting for asynchronous processes critical. Monitoring and alerting enables you to detect issues quickly and either fix them on your own or reach out to Salesforce for assistance. They represent a cost-effective failure mitigation or risk management strategy that will help to ensure that your asynchronous processes remain highly available.

You may have seen guidance on third-party sites for designing custom monitoring and alerting solutions that involve creating error logs when Apex code is executed and inserting the logs into a custom object or a big object. We don’t recommend this approach for the following reasons:

Take some time to explore all available monitoring and debugging options on the platform before opting to use custom error logging as your primary monitoring and alerting solution. Below are two alternative approaches.

Custom Query of the AsyncApexJob Object

If you want to build your own monitoring and alerting solution, you can write SOQL queries against the AsyncApexJob object to check the status of:

With this approach, you can design a UI component that allows users to execute a query and view the results on demand, or you can build a background job that executes the query periodically and sends alerts if it detects any anomalies.

Asynchronous Apex Monitoring via Custom QueryAsynchronous Apex Monitoring via Custom Query

Here are some considerations to keep in mind with this approach:

Proactive Monitoring

Proactive Monitoring allows you to receive performance and dequeue latency alerts that get triggered during the execution of asynchronous processes. System administrators can elect to receive notifications via email, review past alert trends in self-service portal on Salesforce Help, and in specific critical scenarios, alerts may also automatically create Salesforce support cases, which will greatly reduce our support team’s time to detect (TTD) and time to engage (TTE). Note, however, that this feature requires a Signature Success Plan.

Closing Remarks

Keep this guide in mind and refer to it when building or considering asynchronous processing on the core Salesforce Platform. It’s always a good idea to understand the full scope of options available to you, and how they may fit with your specific use case. Be sure to thoroughly assess your current landscape before making changes to any of your existing architectures, especially if your current solution is working well.

Tell us what you think

Help us make sure we're publishing what is most relevant to you: take our survey to provide feedback on this content and tell us what you’d like to see next.