
Salesforce imposes a CPU usage governor limit for every given execution context, from 10 seconds for synchronous transactions to 60 seconds for asynchronous transactions. Simply, the combination of your Apex code and any declarative tools, including AppExchange packages, must not exceed those systemic limits.
What is the CPU time limit in Salesforce apex?
However, Apex CPU Time Limit is an exception. It is non-negotiable. This means we cannot increase the 10-second threshold by tweaking settings, buying more allocations from Salesforce or work around it by other means. It is an absolute hard limit.
What is the CPU usage Governor limit in Salesforce?
After some research, I found out that the Salesforce platform imposes a CPU usage governor limit to any given execution context, which is approximately 10 seconds. It means that Apex Code, declarative tools or a combination in a transaction, must not exceed a ~10-second limit.
Where does the CPU time error come from in Salesforce?
The CPU time error is contained within Salesforce Governor Limits. Let’s dive into the specifics of this, why it’s important, and how we debug it… First of all, what are Salesforce governor limits?
How does Salesforce calculate the limit of a user license?
Salesforce calculates the limit by multiplying the number of user licenses by 1,000; maximum 1,000,000. For example, if you have 10 licenses, your org can process up to 10,000 email messages a day.

What is CPU time in Salesforce?
CPU time is calculated for all executions on the Salesforce application servers occurring in one Apex transaction—for the executing Apex code, and any processes that are called from this code, such as package code and workflows. CPU time is private for a transaction and is isolated from other transactions.
Can we increase CPU time limit in Salesforce?
However, Apex CPU Time Limit is an exception. It is non-negotiable. This means we cannot increase the 10-second threshold by tweaking settings, buying more allocations from Salesforce or work around it by other means. It is an absolute hard limit.
What is heap size limit in Salesforce?
Salesforce enforces an Apex Heap Size Limit of 6MB for synchronous transactions and 12MB for asynchronous transactions. The "Apex heap size too large" error occurs when too much data is being stored in memory during processing.
What is Governor limits in Salesforce?
Simply put, Salesforce Governor Limits are usage caps enforced by Salesforce to ensure efficient processing. They allow for multiple users of the platform without impeding performance. There are many different types of governor limits, some of which are tied to your Salesforce edition.
What is CPU time?
CPU time is calculated for the executing Apex code, and for any processes that are called from this code, such as package code and workflows. CPU time is private for a transaction and is isolated from other transactions. Operations that don't consume application server CPU time aren't counted toward CPU time.
Why does Apex run in a multitenant environment?
Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces limits so that runaway Apex code or processes don’t monopolize shared resources. If some Apex code exceeds a limit, the associated governor issues a runtime exception that can’t be handled.
What is a CPU timeout error?
Salesforce limits CPU usage to 10 seconds for synchronous transactions and 60 seconds for asynchronous transactions. Seeing the error “Apex CPU time limit exceeded” means your transaction is taking too long and can’t be completed. It’s also likely a signal of greater problems in your system.
Optimizing to Avoid CPU Timeout Errors
There are two primary situations in which a CPU timeout will occur. The first is that your processes are simple, but you’re processing too many records at once. In this case, the record count alone will force your code to hit the processing limit.
Automation Best Practices
Whether you’ve hit a CPU timeout error recently or not, it’s important to choose the right type of automation in Salesforce and follow best practices in your Salesforce automation. Check out some of our previous posts on automation best practices.
