An Apex resource exhaustion event is a service protection mechanism that Salesforce triggers when too much competition for server resources occurs during the compilation of Apex code. This can result in degradation or denial of service for affected orgs.
Apex (Salesforce) is the strongly-typed, object-oriented programming language used on the Salesforce platform to write business logic, triggers, and automation. Apex code must be compiled into bytecode before it can be executed. This compiled bytecode is stored in a cache for performance.
Apex recompilation is triggered when compiled bytecode is not available in the Apex bytecode cache. Enabling or disabling any org permission during peak business hours may cause the Apex bytecode cache to be invalidated, forcing Salesforce to recompile Apex code for subsequent requests.
As a general rule: any permission change made during peak hours can potentially invalidate the Apex bytecode cache, leading to resource exhaustion as the platform recompiles large volumes of Apex code simultaneously.
Emergency and patch releases also invalidate the Apex bytecode cache.
Orgs with high traffic and a large number of Apex classes are most at risk of resource exhaustion events. The following best practices reduce this risk.
To prevent Apex bytecode cache invalidation during high-traffic periods, avoid the following actions during peak busy hours:
After making permission or configuration changes outside of peak hours, manually compile Apex code to ensure the bytecode is pre-cached and available before traffic increases again. This prevents recompilation from occurring on live traffic.
Changes made via metadata deploys, package installs, or package upgrades are covered by the compile on deploy feature. This ensures that compiled bytecode is available to handle requests immediately after these types of changes — these do not require manual compilation.
000927355

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.